OneProvider
Clients and SDKs

OpenCode

Add OneProvider to OpenCode as a custom provider in opencode.json: anthropic and openai blocks with options.baseURL and apiKey, one key for Claude and GPT.

OpenCode routes Anthropic and OpenAI models through pluggable providers. Point the anthropic block at OneProvider and you're done.

All models, capabilities, and prices Documentation index for AI agents: https://oneprovider.dev/docs/llms.txt Before you start: a key from your cabinet Open your cabinet: the Telegram bot @oneprovider_robot (Account) or app.oneprovider.dev . Press “Issue a key”, give it a name (for example, this client) and a spend limit, and copy the key. You top up the balance in the same place. More about the cabinet and keys .

Configure

Config path: ~/.config/opencode/opencode.json (or opencode.jsonc). Create the file if it doesn’t exist.

json
{
"provider": {
"anthropic": {
"options": {
"baseURL": "https://api.oneprovider.dev/v1",
"apiKey": "sk-your-key-here"
},
"npm": "@ai-sdk/anthropic"
}
},
"$schema": "https://opencode.ai/config.json"
}

The API key can be set inline (as above) or kept out of the file: the /connect command inside OpenCode (or opencode auth login in a terminal) saves it separately (in 1.x that is ~/.local/share/opencode/auth.json), and the config keeps only baseURL.

Simpler ways

  • Per project. Put the same JSON in opencode.json in the project root: it applies only there and is merged over the global file.
  • Key from an environment variable. Write "apiKey": "{env:ONEPROVIDER_KEY}" and run export ONEPROVIDER_KEY=sk-your-key-here. The file holds no secret and can be committed. If the variable is not set, an empty string is substituted.

Remote machine, CI, container

No need to copy ~/.config over SSH. Keep opencode.json with {env:ONEPROVIDER_KEY} in the repository and set ONEPROVIDER_KEY on that machine (a CI secret, docker run -e, export). In OpenCode 1.x you can also pass the whole config as one variable, OPENCODE_CONFIG_CONTENT: inline JSON, applied after all config files, nothing written to disk. OPENCODE_CONFIG=/path/to/config.json points to a config file elsewhere.

bash
export OPENCODE_CONFIG_CONTENT='{"provider":{"anthropic":{"npm":"@ai-sdk/anthropic","options":{"baseURL":"https://api.oneprovider.dev/v1","apiKey":"sk-your-key-here"}}}}'
opencode

OpenCode 1.x and OpenCode 2

Check your version with opencode --version: the number starts with 1 ( OpenCode 1.x , the older line) or with 2 ( OpenCode 2 , what the official installer gives now). The config on this page is the 1.x format (provider, npm, options), and OpenCode 2 reads it from the same places unchanged. The native 2 format is optional; it writes the same settings with providers, package, settings:

json
{
"providers": {
"anthropic": {
"package": "aisdk:@ai-sdk/anthropic",
"settings": { "baseURL": "https://api.oneprovider.dev/v1", "apiKey": "sk-your-key-here" }
},
"openai": {
"package": "aisdk:@ai-sdk/openai",
"settings": { "baseURL": "https://api.oneprovider.dev/v1", "apiKey": "sk-your-key-here" }
}
}
}

Do not point OpenCode 1.x at a file rewritten to the 2 format: both versions read the same files. OPENCODE_CONFIG and OPENCODE_CONFIG_CONTENT are documented for 1.x; on OpenCode 2 use opencode.json in the project and the ONEPROVIDER_KEY variable for a remote machine.

Routing gpt-* models too

The same key also works for GPT models — add a second provider block. Both live in the same file; pick a model as provider/model-id.

json
{
"provider": {
"anthropic": { "options": { "baseURL": "https://api.oneprovider.dev/v1", "apiKey": "sk-your-key-here" }, "npm": "@ai-sdk/anthropic" },
"openai": { "options": { "baseURL": "https://api.oneprovider.dev/v1", "apiKey": "sk-your-key-here" }, "npm": "@ai-sdk/openai" }
}
}
Default model After saving, run /models inside OpenCode to set a default — claude-sonnet-5-5 for Anthropic, gpt-6.1-terra for OpenAI.

Which model to choose

Use anthropic/claude-sonnet-5-5 as the everyday model: balanced price and quality. Switch to anthropic/claude-opus-5-5 for architecture work and large refactors, and use anthropic/claude-haiku-5-5 where speed matters more than depth. For GPT models use the openai block: openai/gpt-6.1-terra is the balanced default, openai/gpt-6.1-sol the frontier tier. Open /models to pick one; a cheap model also fits OpenCode’s small_model setting for titles and short tasks. Ids are on the models page , rates on the pricing page .

Common errors and fixes

404 “The requested API endpoint does not exist”

In OpenCode the @ai-sdk/anthropic provider expects baseURL with /v1: https://api.oneprovider.dev/v1. Do not add /messages yourself, and do not use the bare host here.

401 Invalid API key

The key in the config is truncated or has quotes around it. You can also run /connect and paste it there (OpenCode 1.x keeps it in ~/.local/share/opencode/auth.json); then remove apiKey from the config.

Config does not load

Smart quotes from a messenger or Notion break JSON. Check the file with jq . ~/.config/opencode/opencode.json, or use opencode.jsonc if you want comments.

The model is not in the list

Pick it as provider/model-id exactly, for example anthropic/claude-sonnet-5-5, and make sure the matching provider block exists in the file.

429 “Insufficient balance”

The balance or the key’s spend limit is used up. Top up the cabinet; retrying does not help.

Streams cut off

Turn off VPN or VLESS proxies: they buffer SSE and break HTTP/2.

FAQ

Where is the config file?

~/.config/opencode/opencode.json (or opencode.jsonc). A project can also have its own opencode.json.

How do I keep the key out of the file?

OpenCode substitutes environment variables: write "apiKey": "{env:ONEPROVIDER_KEY}" and export the variable in your shell.

How do I use it on a remote machine or in CI?

Without copying files over SSH: keep opencode.json with {env:ONEPROVIDER_KEY} in the repository and set ONEPROVIDER_KEY on that machine, or (OpenCode 1.x) pass the whole config in the OPENCODE_CONFIG_CONTENT variable. See “Remote machine, CI, container” above.

Can I use both Claude and GPT?

Yes. Add the openai block from this page next to the anthropic one; one key works for both.

Do I need a Claude or OpenAI account?

No, the OneProvider key is the only credential.

Quick answers

Which base URL do I use?

Claude Code and Anthropic SDKs use https://api.oneprovider.dev. OpenAI SDKs and OpenAI-compatible clients use https://api.oneprovider.dev/v1. One key works behind both; the model list is on the models page ; rates are on the pricing page .

How do I authenticate?

Send the raw sk-… key in x-api-key or Authorization: Bearer: one of them, never both. Keep the key in an environment variable, not in a file that gets committed. More on authentication .

Where do I get a key?

Open your cabinet in the Telegram bot @oneprovider_robot or at app.oneprovider.dev, top up the balance and press “Issue a key”. Each key can carry its own spend limit. Cabinet & API keys .

What do 401, 404 and 429 mean?

401: the key is missing, mistyped or sent in the wrong header; paste the whole key without quotes or spaces. 404: usually a wrong base URL, for example a missing or doubled /v1. 429 with “Insufficient balance”: the cabinet balance or the key’s spend limit is used up, so top up instead of retrying; any other 429 is a rate limit, so wait for Retry-After. Details: error codes and troubleshooting .

Why do streams cut off or reset?

VPN and VLESS proxies often buffer SSE or break HTTP/2 negotiation. OneProvider has no regional restrictions and does not buffer streams, so turn the proxy off and retry.

Where do I ask if this is not enough?

Message @Oneproviderhelpbot on Telegram or open “Support” in the web cabinet, with the HTTP status code and the exact error message. How support works .

Last updated: 2026-11-28 Found a bug? @Oneproviderhelpbot