CLI Tools
Kimi Code
Define an OpenAI provider and model in Kimi’s configuration.
The vendor documents custom endpoints. Check model capabilities and verify the connection.
On this page
Before you begin
Install Kimi CLI using the official guide. If using WSL on Windows, put the configuration in the WSL user directory.
Have an A2Agent API key ready and copy an accessible model ID from the catalog. Replace every placeholder, back up existing settings and keep keys out of repositories.
Setup
File contents are usually shared; switching OS changes commands and paths. For WSL on Windows, select macOS / Linux.
01Install and back up
Run kimi --version after installation and back up config.toml before editing.
Open official documentation02Add model configuration
Merge this configuration and replace the key and model ID. The 32768 context budget is an example; adjust it within your model’s limit.
~/.kimi/config.tomldefault_model = "a2agent" [providers.a2agent] type = "openai" base_url = "https://a2agent.me/v1" api_key = "YOUR_A2AGENT_API_KEY" [models.a2agent] provider = "a2agent" model = "YOUR_MODEL_ID" max_context_size = 3276803Start a session
Run kimi, confirm a2agent is selected, then send a short prompt.
Shellkimi
Capabilities and limits
- This configuration contains a plaintext key. Keep it in your user directory and out of Git.
- Image, reasoning and tool support depend on the model. Do not copy capability declarations from official Kimi models without checking.
Verify the connection
Replace every placeholder and run locally. Expect JSON containing OK. Then start a new client conversation, test one read-only tool call separately, and confirm the requests in A2Agent usage records. This test incurs a small amount of model usage.
curl --fail-with-body --silent --show-error --max-time 60 'https://a2agent.me/v1/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_A2AGENT_API_KEY' \
-d '{"model":"YOUR_MODEL_ID","max_tokens":128,"messages":[{"role":"user","content":"Reply with OK."}]}'Troubleshooting
OPENAI_API_KEY does not automatically replace api_key in this configuration. Check the names linking providers and models if parsing fails.
401 / 403: authentication or access denied
Use a key issued by A2Agent, without extra spaces, and check that it is active and unexpired. Confirm the group permits the model and protocol. A vendor subscription credential cannot replace an A2Agent key.
404 / model not found: endpoint or model mismatch
Check the root URL, /v1 prefix and full request path against this guide; avoid duplicated paths. Model IDs are case-sensitive and must be accessible to the current key.
429: quota or rate limit
Check your balance, key limits, concurrent usage and service status. Wait before retrying and reduce simultaneous agents; repeated retries do not remove a quota limit.
Chat works, but tools fail or streaming stops
Test a short text request, then a single read-file tool call. Check tool support, output budget, proxy timeouts and client version. Inspect the diff before resuming a long task to avoid repeating actions.
Restore previous settings
Restore the backup or previous default_model, then remove providers.a2agent and models.a2agent.
Sources and check date
Status is based on official configuration docs, not end-to-end client testing with A2Agent.
Docs checked 2026-09-18
