Connect your tools
OpenCode
Add Kontinent AI to OpenCode as a custom provider in opencode.json. Use Claude, GPT and Gemini models through the chat completions endpoint.
Or let your agent do it
Paste the prompt into your coding agent. The agent writes the configuration and tests it.
OpenCode can send OpenAI chat completions requests to a custom provider. Kontinent AI serves that
format at https://api.kontinentai.com/v1/chat/completions, for Claude, GPT and Gemini models.
Before you start, make sure that you have:
- OpenCode, installed.
- A Kontinent AI key. See Quickstart.
- Balance from a top-up or a redemption code. OpenCode sends prompts that are too long for the starter balance.
1. Set the key
export KONTINENT_API_KEY="sk-kont-..."
Put this line in your shell profile, for example ~/.zshrc, so that each new shell has the key.
2. Add the provider
Open ~/.config/opencode/opencode.json. If the file does not exist, create it. Add the kontinent
provider:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"kontinent": {
"npm": "@ai-sdk/openai-compatible",
"name": "Kontinent AI",
"options": {
"baseURL": "https://api.kontinentai.com/v1",
"apiKey": "{env:KONTINENT_API_KEY}"
},
"models": {
"claude-sonnet-5-5": { "name": "Claude Sonnet 5.5" },
"claude-opus-5-5": { "name": "Claude Opus 5.5" },
"claude-haiku-4-5-20251001": { "name": "Claude Haiku 4.5" },
"gpt-5.5": { "name": "GPT-5.5" },
"gemini-3.1-pro-preview": { "name": "Gemini 3.1 Pro" },
"gemini-3.5-flash": { "name": "Gemini 3.5 Flash" }
}
}
},
"model": "kontinent/claude-sonnet-5-5"
}
| Key | What it does |
|---|---|
npm | The package that OpenCode uses to send chat completions requests |
options.baseURL | Our API. The package adds /chat/completions to it |
options.apiKey | {env:KONTINENT_API_KEY} reads the key from your environment |
models | The model ids that OpenCode shows. Each key must be a model id from the list on this page |
model | The model that OpenCode selects when it starts, as provider/model |
To put the provider in one project only, put the same content in opencode.json at the root of the
project. Do not put the key itself in that file.
3. Make sure that the connection works
Send one small request with curl:
curl -sS -w '\n%{http_code}\n' https://api.kontinentai.com/v1/chat/completions \
-H "Authorization: Bearer $KONTINENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "claude-haiku-4-5-20251001", "max_tokens": 16, "messages": [{"role": "user", "content": "Say OK."}]}'
A JSON response that ends with 200 shows that the key and the URL are correct. Then do these steps:
- Run
opencode models kontinent. OpenCode shows the models from your file. - Run
opencode run -m kontinent/claude-haiku-4-5-20251001 "Say OK.". OpenCode prints the answer.
Models
These models work on the chat completions endpoint. This list comes from our model catalogue. You
can add each of them to the models object:
claude-opus-5-5claude-opus-5claude-sonnet-5-5claude-sonnet-5claude-haiku-4-5-20251001claude-fable-5-1gpt-5.5gpt-6.1-solgpt-5gemini-3.1-pro-previewgemini-3.5-flashglm-5.3qwen3.8-maxdeepseek-v4.1-flash
Costs and limits
- OpenCode streams its responses. We record the cost of each request, and the dashboard shows it.
- Each request counts toward the limit of 60 requests a minute for each key.
- The file above has no
limitobject for each model. If you add one, OpenCode needscontextandoutput. Thecontext_windowfield ofGET /v1/modelsgives the context window of each model.
Problems
| Problem | What to do |
|---|---|
401 | Make sure that the shell that starts OpenCode has KONTINENT_API_KEY |
402 | Your balance is too low. Top up on the balance page |
400 that says is not served on /v1/chat/completions | Remove that model from the models object |
404 that names a model | Make sure that each key in models is a model id from the list on this page |
The OpenCode documentation for custom providers is at opencode.ai.