Skip to main content

Use OceanToken in Kilo Code

Kilo Code runs on OceanToken as a custom provider that speaks the OpenAI Compatible API. The VS Code extension and the kilo CLI read the same configuration, so you set it up once for both. These steps were tested on 2026-10-18 with the Kilo CLI 7.8.12: tool calls, streaming, images, reasoning and prompt caching.

Before you start​

Create an API key for Kilo Code and give it a Credit limit. An agent sends many requests, and the limit caps what this key can spend. See Before you start for how to keep the key in an environment variable and check it.

Set up in VS Code​

  1. Open Kilo Code's settings and go to Providers.
  2. Find Custom provider ("Add a custom provider by base URL") and click Connect.
  3. Fill in the dialog:
    • Provider ID: oceantoken
    • Display name: OceanToken
    • Provider API: OpenAI Compatible. Use it for Claude models too.
    • Base URL: https://api.oceantoken.ai/v1
    • API key: your OceanToken key
  4. Under Models, click Fetch models, search for the model IDs in the table below and add the ones you want. The list has every model your key can use, including image, video and speech models, so add text models only.
  5. For each model you added, turn on Reasoning, and turn on Image if its Images column says Yes.
  6. Save, then add token limits and image attachments.
  7. Pick an OceanToken model in Kilo Code's model selector and start a short task.

Add token limits​

The dialog saves no context window or output limit, and without them Kilo Code never compacts a long conversation. It also does not mark a model as accepting attached files, so an image you attach is not sent. Open the configuration file (Edit provider, then Edit advanced settings in the JSON config file) and give each model a limit with the numbers from the table, plus "attachment": true on models whose Images column says Yes:

"anthropic/claude-sonnet-5.5": {
"name": "Claude Sonnet 5.5",
"reasoning": true,
"attachment": true,
"modalities": { "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 1000000, "output": 32000 }
}

Keep output at 32,000: a coding turn rarely needs more, and a smaller limit caps the cost of any one reply.

Set up without the dialog, or for the CLI​

Install the CLI with npm install -g @kilocode/cli. Put the whole provider in ~/.config/kilo/kilo.jsonc for every project, or in kilo.jsonc at the root of one project:

{
"provider": {
"oceantoken": {
"npm": "@ai-sdk/openai-compatible",
"name": "OceanToken",
"env": ["OCEANTOKEN_API_KEY"],
"options": { "baseURL": "https://api.oceantoken.ai/v1" },
"models": {
"anthropic/claude-sonnet-5.5": {
"name": "Claude Sonnet 5.5",
"reasoning": true,
"attachment": true,
"modalities": { "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 1000000, "output": 32000 }
},
"openai/gpt-5.5": {
"name": "GPT-5.5",
"reasoning": true,
"attachment": true,
"modalities": { "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 1050000, "output": 32000 }
},
"deepseek/deepseek-v4-pro": {
"name": "DeepSeek V4 Pro",
"reasoning": true,
"limit": { "context": 1048576, "output": 32000 }
}
}
}
},
"model": "oceantoken/anthropic/claude-sonnet-5.5"
}

The key comes from the OCEANTOKEN_API_KEY environment variable, so the file holds no secret. Check the setup:

export OCEANTOKEN_API_KEY=sk-...
kilo run "Reply with the single word OK"

A model is named oceantoken/<model id>: kilo run -m oceantoken/openai/gpt-5.5 "...". Attach an image with -f screenshot.png.

These models were tested with Kilo Code's tools. Each model's price is on its page on oceantoken.ai, linked from the Price column. The Models page lists every model.

Prompt caching and reasoning​

  • Prompt caching works without any setting. Kilo Code marks Claude prompts for caching, and GPT, DeepSeek, Qwen and GLM models cache on their own. From the second turn of a task, the repeated part of the prompt is billed at the Cached input price.
  • Reasoning effort: models with Reasoning on get variants in Kilo Code's model selector. In the CLI, add --variant high (or low, medium). Kilo Code sends it to the model as reasoning_effort.

Each request's charge, cached input included, is in the console under Logs.

Troubleshooting​

What you seeWhat to do
Invalid API key. Check the key, or create one in the OceanToken console.The key is wrong, revoked or has a stray space. Enter it again, or check that OCEANTOKEN_API_KEY is set in the shell that runs kilo.
Unknown model '…'. GET /v1/models lists the models your key can use.The model ID in the configuration is misspelled. Use it exactly as the Models page writes it, with the publisher in front.
This model does not accept image input. or The upstream model provider returned an error. right after you attach an imageThe model reads text only. Turn Image off for it, or pick a model whose Images column says Yes.
The model says it cannot see the image you attachedThe model has no "attachment": true in the configuration file. Add it.
Insufficient balance - please add credit to continue.Add credits. If you still have a balance, lower the model's output limit: a request starts only when your balance covers the most its reply can cost.
A long session never compacts and finally fails for lengthThe model has no limit. Add token limits.
reasoning part 0 not foundThe provider was set up with Provider API Anthropic Messages. Use OpenAI Compatible.