Custom Models
CodeArts Agent CLI supports third-party large language models (LLMs). If you have purchased the CodeArts Agent professional edition, you can also add third-party LLMs on the console. For details, see "Configuring Custom Models".
Constraints
- Only third-party custom enterprise models using the OpenAI-compliant Chat Completions APIs and Anthropic-compliant Messages APIs can be integrated.
- The custom models created on the console can be invoked by all agents. However, those created on the client can be invoked only by the system built-in agents, AgentTeam, and custom agents.
- The provider and model ID combination of each model you add must be unique.
Prerequisites
- Your account has been added as an enterprise member and assigned a seat.
- If you have purchased CodeArts Agent professional edition, ensure that the enterprise administrator has enabled model customization for members on the console. For details, see Configuring Custom Models.
Custom Model Configuration File
CodeArts Agent CLI allows you to manage custom models using a configuration file. On the CLI or TUI, you cannot create, modify, or delete custom models using commands. Instead, you can edit all configurations only by editing the file.
The configuration file for custom models is codearts_cli.json, which is stored in ~/.codeartsdoer/. The tilde (~) indicates the home directory of the current user. In Windows, it is equivalent to C:\Users\Username\. In macOS, it is equivalent to /Users/Username/. In Linux, it is equivalent to /home/Username/.
In the configuration file, provider is the top-level key. Each provider ID matches a configuration block. The complete structure of the configuration file is as follows:
{
"provider": {
"<Provider ID>": {
"name": "<Provider name>",
"npm": "<SDK package name>",
"api": "<Provider API URL>",
"env": ["<Environment variable name>", ...],
"whitelist": ["<Model ID>", ...],
"blacklist": ["<Model ID>", ...],
"options": {
"apiKey": "<API key>",
"baseURL": "<Base API URL>",
"enterpriseUrl": "<Enterprise edition URL>",
"setCacheKey": true,
"timeout": 300000,
"chunkTimeout": 60000
},
"models": {
"<Model ID>": {
"id": "<Model API ID>",
"name": "<Displayed name>",
"family": "<Model family>",
"reasoning": true,
"attachment": true,
"temperature": true,
"tool_call": true,
"limit": { "context": 128000, "input": 120000, "output": 8000 },
"cost": {
"input": 3.0,
"output": 15.0,
"cache_read": 0.5,
"cache_write": 2.0,
"context_over_200k": {
"input": 6.0,
"output": 30.0,
"cache_read": 1.0,
"cache_write": 4.0
}
},
"modalities": {
"input": ["text", "image", "pdf"],
"output": ["text"]
},
"headers": { "X-Custom-Header": "value" },
"status": "active",
"provider": { "npm": "<SDK package name>", "api": "<API URL>" },
"variants": { ... }
}
}
}
}
}
apiKey is your core asset. Do not disclose it. After you configure apiKey and restart the TUI or CLI, apiKey will be automatically encrypted. The ciphertext apiKey will then be displayed in the configuration file.
The provider ID is a top-level key in the configuration file and is used to identify the model source. Table 1 lists common provider IDs. You can also use any custom string (for example, my-server) as the provider ID, as long as the corresponding model supports OpenAI-compatible API formats.
| Provider ID | Description |
|---|---|
| openai | OpenAI |
| deepseek | DeepSeek |
| glm | glm |
| kimi | kimi |
| Field | Type | Mandatory | Description |
|---|---|---|---|
| provider.<Provider ID>.name | String | No | Displayed name of the provider. The default value is the provider ID. |
| provider.<Provider ID>.npm | String | No | SDK package name. The default value is @ai-sdk/openai-compatible. |
| provider.<Provider ID>.api | String | No | API URL of the provider. It is similar to options.baseURL. |
| provider.<Provider ID>.env | String array | No | List of environment variable names. CodeArts Agent CLI reads these environment variables in sequence and uses them to roll back the API key. |
| provider.<Provider ID>.whitelist | String array | No | Model whitelist. Only models in the list will be loaded. (This list can be used to filter out unnecessary models for built-in providers.) |
| provider.<Provider ID>.blacklist | String array | No | Model blacklist. Models in the list will not be loaded. |
| provider.<Provider ID>.options.apiKey | String | Yes | API key. When loaded for the first time, the plaintext key is automatically encrypted in enc:v1: format and written back to the configuration file. |
| provider.<Provider ID>.options.baseURL | String | Yes | Base URL of the API, for example, https://your-server.com/v1 |
| provider.<Provider ID>.options.enterpriseUrl | String | No | GitHub Enterprise URL, which is only used for the authentication of Copilot providers' enterprise editions |
| provider.<Provider ID>.options.setCacheKey | Boolean | No | Whether to enable promptCacheKey. The default value is false. |
| provider.<Provider ID>.options.timeout | Number or false | No | Request timeout interval, in milliseconds. The default value is 300,000 (5 minutes). If this parameter is set to false, timeout is disabled. |
| provider.<Provider ID>.options.chunkTimeout | Number | No | Timeout interval between blocks in an SSE streaming response, in milliseconds. If no new data block is received within this period, the request is interrupted. |
| provider.<Provider ID>.options.* | Any type | No | Options support any additional fields (catchall). The SDK implementation of the provider may read these custom options. |
| provider.<Provider ID>.models.<Model ID>.id | String | No | API identifier of the model (model ID sent to the provider). By default, it is the configuration key name. |
| provider.<Provider ID>.models.<Model ID>.name | String | No | Model name displayed on the CodeArts Agent CLI client. By default, it is the configuration key name. |
| provider.<Provider ID>.models.<Model ID>.family | String | No | Model family name (such as gpt and claude), which is used for grouping models |
| provider.<Provider ID>.models.<Model ID>.reasoning | Boolean | No | Whether reasoning and thinking capabilities are supported |
| provider.<Provider ID>.models.<Model ID>.attachment | Boolean | No | Whether attachments such as images and PDF files can be uploaded |
| provider.<Provider ID>.models.<Model ID>.temperature | Boolean | No | Whether the temperature can be adjusted |
| provider.<Provider ID>.models.<Model ID>.tool_call | Boolean | No | Whether tools or functions can be called. The default value is true. |
| provider.<Provider ID>.models.<Model ID>.limit.context | Number | No | Maximum context window size (token) |
| provider.<Provider ID>.models.<Model ID>.limit.input | Number | No | Maximum number of input tokens |
| provider.<Provider ID>.models.<Model ID>.limit.output | Number | No | Maximum number of output tokens |
| provider.<Provider ID>.models.<Model ID>.cost.input | Number | No | Unit price of input tokens (price per million tokens) |
| provider.<Provider ID>.models.<Model ID>.cost.output | Number | No | Unit price of output tokens |
| provider.<Provider ID>.models.<Model ID>.cost.cache_read | Number | No | Unit price of cache reading |
| provider.<Provider ID>.models.<Model ID>.cost.cache_write | Number | No | Unit price of cache writing |
| provider.<Provider ID>.models.<Model ID>.cost.context_over_200k | Object | No | Alternative prices when the context has over 200K tokens, including input, output, cache_read, and cache_write |
| provider.<Provider ID>.models.<Model ID>.modalities.input | String array | No | Supported input modalities, including text, audio, image, video, and pdf |
| provider.<Provider ID>.models.<Model ID>.modalities.output | String array | No | Supported output modalities, including text, audio, image, video, and pdf |
| provider.<Provider ID>.models.<Model ID>.headers | String of key-value objects | No | Custom HTTP request header, which is sent with the model request |
| provider.<Provider ID>.models.<Model ID>.status | String | No | Model status, which can be active, beta, alpha, or deprecated |
| provider.<Provider ID>.models.<Model ID>.provider.npm | String | No | Name of the SDK package used by the model, which overwrites the default value from the provider |
| provider.<Provider ID>.models.<Model ID>.provider.api | String | No | API URL of the model, which overwrites the default value from the provider |
| provider.<Provider ID>.models.<Model ID>.variants | Key-value object | No | Variants |
Custom Model Configuration Example
The following steps describe how to customize a model with the minimum configuration in Windows by setting the provider ID, API key, and model.
- Go to the %USERPROFILE%/.codeartsdoer directory and find and open the codearts_cli.json configuration file.
- Add the following provider information to the codearts_cli.json file:
{ "$schema": "https://opencode.ai/config.json", "provider": { "deepseek": { "options": { "apiKey": "sk-***", "baseURL": "https://api.deepseek.com/v1" }, "models": { "deepseek-chat": { "name": "DeepSeek Chat" }, "deepseek-reasoner": { "name": "DeepSeek Reasoner", "reasoning": true } } } }, "mcp": {}, "lsp": false }You need to purchase an API key from the DeepSeek official website and then set apiKey.
- Save the file and exit.
- Check whether the custom model has been added.
- Run the following command in the CLI environment and check whether the custom model is included in the model list displayed in the command output:
codearts models
- In the TUI environment, run the following slash command to go to the Select model page and check whether the custom model is available:
/models
- Run the following command in the CLI environment and check whether the custom model is included in the model list displayed in the command output:
Specifying the Model to Run
In CodeArts Agent CLI, you can specify a model to run your task. In the following command, provider indicates the model provider, and model indicates the model name.
- TUI development environment
- When starting TUI, you can run the following command to specify the model to run:
codearts --model provider/model You can also use a short parameter. codearts -m provider/model
- In the TUI development environment, you can enter the /models command to quickly switch models.
- When starting TUI, you can run the following command to specify the model to run:
- CLI development environment
codearts run --model provider/model "Your question"
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot