Skip to main content

Run your coding agent on OceanToken

Point the agent's own model at OceanToken and its requests run on your OceanToken key and balance, with any suitable model from the Models page. This is separate from adding OceanToken's tools to an agent; you can do either or both.

Before you start​

  1. Create an API key for the agent and give it a Credit limit. Agents send many requests, and the limit caps what this one can spend.

  2. Keep the key in an environment variable, never in a file in your repository:

    export OCEANTOKEN_API_KEY=sk-...
  3. Check it:

    curl -s https://api.oceantoken.ai/v1/models -H "Authorization: Bearer $OCEANTOKEN_API_KEY" | head -c 300

Codex​

Codex 0.135 and later keep each profile in its own file next to config.toml (check with codex --version). Two additions put OceanToken one flag away and leave your default setup as it is. Back up ~/.codex/config.toml before you edit it.

  1. Append the provider to ~/.codex/config.toml. On its own it changes nothing:

    [model_providers.oceantoken]
    name = "OceanToken"
    base_url = "https://api.oceantoken.ai/v1"
    env_key = "OCEANTOKEN_API_KEY"
    wire_api = "responses"
  2. Create ~/.codex/oceantoken.config.toml with two lines and no table header:

    model_provider = "oceantoken"
    model = "openai/gpt-5.5"

Run Codex with codex --profile oceantoken, and check the setup with:

codex exec --skip-git-repo-check --profile oceantoken "Reply with the single word OK"

Plain codex, without --profile, runs your usual setup, so that is how you switch back. To remove OceanToken, delete oceantoken.config.toml and the [model_providers.oceantoken] table.

  • Set up from an earlier version of this page? Delete the [profiles.oceantoken] table from config.toml. Codex 0.135 and later refuse --profile oceantoken while it is there.
  • Codex 0.134 or earlier has no profile files: put the same two lines under a [profiles.oceantoken] table in config.toml instead.
  • OceanToken as the default, with no flag: put the two lines at the top of config.toml, above the first [table], in place of any model or model_provider line already there. To switch back, restore those lines from your backup.

Codex runs tools on almost every turn, so choose a model that handles tool calls well; OpenAI GPT-5 family models are the safe choice. Avoid aion-labs/aion-2.0 for Codex and other agents that run tools: after a tool call it tends to write its final answer into its reasoning, so the turn shows no answer. It is fine for plain chat.

Claude Code​

Claude Code speaks the Anthropic Messages API, which OceanToken serves for its Claude models. For one project, put this in .claude/settings.local.json, which git ignores; for every project, in ~/.claude/settings.json:

{
"env": {
"ANTHROPIC_BASE_URL": "https://api.oceantoken.ai",
"ANTHROPIC_AUTH_TOKEN": "<your OceanToken key>",
"ANTHROPIC_MODEL": "anthropic/claude-sonnet-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5"
}
}

ANTHROPIC_BASE_URL has no /v1: like the Anthropic SDK, Claude Code adds it itself. Use model names exactly as the Models page lists them. Check the setup with:

claude -p "Reply with the single word OK"

The settings file holds the key in plain text. Prefer the project-local file, keep it out of git, and remember where it is.

Other tools​

Any tool that lets you set an OpenAI-compatible base URL and key works the same way: base URL https://api.oceantoken.ai/v1, your OceanToken key, and a model name from the Models page. A tool that speaks the Anthropic API takes https://api.oceantoken.ai and a Claude model.

Costs​

Every request the agent makes is an ordinary API request: charged to your balance at the model's price and listed in the console under Logs. Agents resend long prompts on every turn, so the Cached input price on the Models page matters as much as the input price. If a key may have leaked, rotate it.