Adding a Provider
By adding providers, you can connect different LLM services to Elftia and freely switch between models during chat. Elftia offers three methods: preset templates, custom configuration, and import/export.
When to Use
- You are setting up Elftia for the first time and need to configure an API key to enable the default providers
- You need to connect to an LLM service that is not in the default list
- You want to add multiple instances of the same provider (e.g. endpoints in different regions)
- You are migrating your configuration from another device
Method 1: Add from a Preset Template
Preset templates include the provider's Base URL, default model list, and recommended configuration — you only need to fill in your API key to complete the setup.
Steps
- Open Settings → Provider Management
- Click the Add Provider button
- Select a preset template from the provider list
- In the configuration panel that appears, enter your API Key
- Paste the key value directly, e.g.
sk-xxxxxxxxxxxxxxxx - Or reference an environment variable, e.g.
$OPENAI_API_KEY
- Paste the key value directly, e.g.
-
Click Test Connection to confirm the key is valid
- Success: a green message "Connection successful" is displayed
- Failure: an error message is shown (see Troubleshooting)
-
Enable the Enabled toggle
-
Click Save
Once done, the provider's models will appear in the model selection dropdown in the chat UI.
Preset Template Reference
International Providers
| Preset ID | Name | API Format | Base URL | Highlights |
|---|---|---|---|---|
openai | OpenAI | openai | https://api.openai.com/v1/chat/completions | GPT-4o/5, o1/o3 reasoning series, vision support |
anthropic | Anthropic | anthropic | https://api.anthropic.com/v1/messages | Claude Sonnet/Opus/Haiku 4.5, native chain-of-thought |
gemini | Google Gemini | https://generativelanguage.googleapis.com/v1beta/models/ | 1M-token context, vision + reasoning | |
openai-response | OpenAI (Responses API) | openai-response | https://api.openai.com | GPT-5 series + o3/o4, new API |
azure-openai | Azure OpenAI | azure-openai | (custom) | Enterprise SLA; deployment name used as model |
openrouter | OpenRouter | openai | https://openrouter.ai/api/v1 | Aggregates 200+ models with a single key |
groq | Groq | openai | https://api.groq.com/openai/v1 | Ultra-fast inference engine |
ollama | Ollama | openai | http://localhost:11434/v1 | Local deployment, free to use |
Chinese Cloud Platforms
| Preset ID | Name | API Format | Base URL | Highlights |
|---|---|---|---|---|
zhipu | Zhipu GLM | openai | https://api.z.ai/api/paas/v4 | GLM-5/4.5/4.6V/4.7, Coding Plan |
volcengine | Volcengine (Ark) | openai | https://ark.cn-beijing.volces.com/api/v3 | Doubao Seed 2.0, intelligent routing, multi-model aggregation |
kimi | Kimi (Moonshot) | openai | https://api.moonshot.ai/v1 | Kimi K2.5, 256K context |
dashscope | Alibaba Cloud Bailian | openai | https://dashscope.aliyuncs.com/compatible-mode/v1 | Qwen3 series, 1M tokens |
tencent | Tencent Cloud Hunyuan | openai | https://api.lkeap.cloud.tencent.com/v1 | Hunyuan 2.0, multi-model aggregation |
minimax | MiniMax | anthropic | https://api.minimaxi.com/anthropic | M2.5/M2.1, Anthropic format |
baidu | Baidu Qianfan | openai | https://qianfan.baidubce.com/v2 | ERNIE series, Coding Plan |
kuaishou | Kuaishou KwaiKAT | openai | https://wanqing.streamlakeapi.com/api/gateway/v1 | KAT-Coder, optimized for coding |
mthreads | Moore Threads | openai | (requires configuration) | Domestic chip Coding Plan |
Method 2: Custom OpenAI-Compatible Provider
If the LLM service you use provides an OpenAI-compatible API (most services do), you can add it as a custom provider.
Steps
- Open Settings → Provider Management
- Click Add Provider → select Custom Provider
- Fill in the basic information:
| Field | Required | Description | Example |
|---|---|---|---|
| Name | Yes | Display name | My Local LLM |
| API Format | Yes | Select the protocol format | openai (most common) |
| Base URL | Yes | API address | http://localhost:8080/v1/chat/completions |
| API Key | No | Authentication key | sk-... (can be left empty for local services) |
- Add models:
- Click Add Model
- Enter the model ID (the name used when calling the API, e.g.
llama-3.1-70b) - Enter the display name
- Set model capability flags (vision, function calling, reasoning, etc.)
-
(Optional) Configure a Transformer:
- If the target service's API differs from the standard OpenAI format, add an appropriate transformer
- Common choices:
deepseek(for DeepSeek-compatible services),groq(for Groq-compatible services)
-
Click Test Connection to verify the configuration
-
Enable the Enabled toggle and save
Model Discovery
Some providers support automatic model discovery via the /v1/models endpoint:
- In the provider configuration, fill in the Model Discovery Endpoint (e.g.
https://api.example.com/v1/models) - Click the Discover Models button
- Elftia calls the endpoint to fetch the model list
- Select the models you want to add from the returned results
Method 3: Import / Export
Exporting a Configuration
- Open Settings → Provider Management
- Select the provider you want to export
- Click the Export button
- The configuration is saved as a JSON file
Importing a Configuration
- Open Settings → Provider Management
- Click the Import button
- Select the previously exported JSON file
- Review the imported provider information
- Enter the API key (for security reasons, the exported file does not include the API key)
- Save and enable
Environment Variable API Keys
Using environment variables to manage API keys is the recommended approach, especially in the following scenarios:
- You prefer not to store the key in plaintext in the application database
- You share configuration files across multiple devices, each using a different key
- You use Elftia in CI/CD or automation scenarios
How to Configure
In the API key input field, enter the environment variable name prefixed with $:
| Input value | Resolved at runtime to |
|---|---|
$OPENAI_API_KEY | The value of process.env.OPENAI_API_KEY |
$ANTHROPIC_API_KEY | The value of process.env.ANTHROPIC_API_KEY |
$MY_CUSTOM_KEY | The value of process.env.MY_CUSTOM_KEY |
Note: if the corresponding environment variable is not set, API requests will fail with an authentication error. You must restart Elftia after changing environment variables for the new values to take effect.
Configuration Reference
| Setting | Type | Default | Description |
|---|---|---|---|
| Name | String | (template name) | Provider display name |
| API Format | Enum | openai | openai / anthropic / google / azure-openai / openai-response |
| Base URL | URL | (varies by template) | API request address; must start with http:// or https:// |
| API Key | String | (empty) | Supports $ prefix to reference environment variables |
| Model list | Array | (varies by template) | Can be added, removed, or fetched via model discovery |
| Model discovery endpoint | URL | (optional) | Call /v1/models or similar endpoints to auto-fetch the model list |
| Enabled | Boolean | false | Newly added providers are disabled by default |
| Transformer | Array | (varies by format) | Request/response format transformer chain |
| Icon | String | (varies by template) | Provider icon identifier |
| Website link | URL | (optional) | Provider's website, used for documentation links |
| Notes | String | (empty) | Free-form notes |
| API Version | String | (Azure only) | API version number for Azure OpenAI |
| Concurrency limit | Number | (varies by provider) | Maximum concurrent requests in Agent mode |
| Is official | Boolean | false | Marks the provider as an official Anthropic provider (affects chain-of-thought signature handling) |
Behavior Notes
Preset Templates vs. Custom Providers
| Feature | Preset template | Custom provider |
|---|---|---|
| Base URL | Auto-filled | Must be entered manually |
| Model list | Pre-configured | Must be added manually |
| Transformer | Auto-configured | Optional |
| Model discovery | Supported for some | Must set endpoint manually |
| Coding Plan | Supported for some | Not supported |
| Search integration | Pre-configured | Must be configured manually |
Provider ID Uniqueness
Each provider has a unique ID. When adding multiple instances from the same preset template, Elftia automatically appends a suffix to the ID to ensure uniqueness.
Initial State After Adding
A newly added provider is disabled by default. You must:
- Enter a valid API key
- Successfully test the connection
- Manually enable the toggle
before you can use that provider's models in chat.
Troubleshooting
| Issue | Possible cause | Solution |
|---|---|---|
| Test connection returns 401 | API key is invalid or expired | Regenerate the key on the provider's website |
| Test connection returns 403 | Key lacks permission | Confirm the key has access to the target model |
| Test connection times out | No network connection or incorrect Base URL | Check network connectivity and URL spelling |
$ENV_VAR key is invalid | Environment variable is not set | Set the environment variable in the system and restart Elftia |
| Model discovery returns an empty list | Incorrect endpoint or key lacks permission | Check the model discovery endpoint URL; confirm the key has list-models permission |
| Save fails with invalid URL error | Base URL format is incorrect | Make sure it starts with http:// or https:// |
| Custom provider requests fail | Transformer configuration mismatch | Confirm the API format selection is correct, or try adding the corresponding transformer |
| Azure OpenAI connection fails | Incorrect API version or deployment name | Confirm the API Version field is filled in (e.g. 2024-08-01-preview); use the deployment name as the model name |
| MiniMax request format error | Not using anthropic format | MiniMax uses the Anthropic API format — select anthropic and configure the anthropic transformer |
Related Pages
- LLM Providers Overview - Overall architecture of the provider system
- API Key Pools - Configure multiple API keys for a single provider
- Custom Endpoints - Detailed guide for connecting to local services like Ollama and LM Studio
- Model Parameters - Configure generation parameters such as temperature and max_tokens