Skip to content

Codex CLI, Cursor, OpenCode and Kilo Code on one API key

Step-by-step setup for four popular coding tools on apmix: one base URL, one key, and every model in your plan, from GPT and Claude to Gemini and DeepSeek.

The apmix teamPublished 3 min read
Four floating rounded tiles connected by thin lines to a single central black node.
On this page
  1. Codex CLI
  2. Cursor
  3. OpenCode
  4. Kilo Code
  5. Which model should you pick?
  6. Other tools

Most coding tools let you bring your own OpenAI-compatible endpoint. That is all apmix needs: point a tool at https://api.apmix.ai/v1, give it your apmix key, and every model in your plan is available in it, including Claude, Gemini, DeepSeek and Qwen, not only GPT.

Below is the setup for four of the most used tools. Each takes two or three minutes. Replace apx_live_YOUR_KEY with a key from your dashboard; the model ids come from the catalog.

Codex CLI

Codex is OpenAI's terminal agent. It reads custom providers from ~/.codex/config.toml and talks to the Responses API, which apmix serves at /v1/responses.

Codex CLI running in a terminal
Codex CLI in the terminal. Image: openai/codex, Apache-2.0.

Install it (Node.js 18 or newer):

Terminal
npm install -g @openai/codex

Register apmix as a provider and make it the default:

~/.codex/config.toml
model = "gpt-5.6-luna"
model_provider = "apmix"

[model_providers.apmix]
name = "apmix"
base_url = "https://api.apmix.ai/v1"
env_key = "APMIX_API_KEY"
wire_api = "responses"

Codex reads the key from the variable named by env_key. Store it for future terminals:

Terminal
echo 'export APMIX_API_KEY="apx_live_YOUR_KEY"' >> ~/.zshrc   # or ~/.bashrc
export APMIX_API_KEY="apx_live_YOUR_KEY"

On Windows, in PowerShell:

PowerShell
[Environment]::SetEnvironmentVariable("APMIX_API_KEY", "apx_live_YOUR_KEY", "User")
$env:APMIX_API_KEY = "apx_live_YOUR_KEY"

Open a new terminal and run codex inside your project. codex --model <id> switches the model for one session.

Cursor

Cursor routes every custom endpoint through its OpenAI settings, including Claude, Gemini and Grok models.

  1. Press Ctrl+Shift+J (⌘⇧J on Mac) to open Cursor Settings, and choose Models.
  2. In the search box, type the model id exactly, for example gpt-5.6-terra, and click Add Custom Model.
  3. Scroll down to API Keys and turn on OpenAI API Key. Leave the Anthropic and Google fields empty.
  4. Paste your apmix key into the OpenAI API Key field.
  5. Turn on Override OpenAI Base URL, paste https://api.apmix.ai/v1 and click Verify.
  6. In the chat's model dropdown, turn off Auto and select your model.
The Cursor steps on the apmix docs page
The same Cursor steps in the docs, with your key and model filled in.

Chat, Agent and Cmd+K now run on apmix. Tab completion keeps using Cursor's own models, as it does for every custom key.

OpenCode

OpenCode is an open-source terminal agent. Install it with npm, or with the install script on macOS and Linux:

Terminal
npm install -g opencode-ai

Add apmix as a provider in ~/.config/opencode/opencode.json (or in an opencode.json at the root of a project):

~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "apmix/gpt-5.6-luna",
  "provider": {
    "apmix": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "apmix",
      "options": { "baseURL": "https://api.apmix.ai/v1", "apiKey": "apx_live_YOUR_KEY" },
      "models": {
        "gpt-5.6-luna": { "name": "GPT 5.6 Luna" },
        "claude-sonnet-5": { "name": "Claude Sonnet 5" },
        "gemini-3.1-pro": { "name": "Gemini 3.1 Pro" }
      }
    }
  }
}

Start opencode and pick a model with /models; the apmix models appear in their own group. Add any other id from the catalog to the models map whenever you like.

OpenCode's terminal interface
OpenCode's terminal interface. Image: anomalyco/opencode, MIT License.

Kilo Code

Kilo Code runs in VS Code, in JetBrains IDEs and in the terminal.

Kilo Code in VS Code next to the Kilo CLI
Kilo Code in VS Code, beside the Kilo CLI. Image: Kilo-Org/kilocode, MIT License.

In the editor, install the Kilo Code extension, open its Settings (the gear), go to Providers and click Custom provider. Choose OpenAI Compatible and fill in:

text
Provider ID     apmix
Provider API    OpenAI Compatible
Base URL        https://api.apmix.ai/v1
API key         apx_live_YOUR_KEY
Model           gpt-5.6-luna

Kilo then lists every model your key can reach, straight from /v1/models.

In the terminal, install the CLI and give it the same provider. It is a fork of OpenCode and reads the same shape of config:

Terminal
npm install -g @kilocode/cli
~/.config/kilo/kilo.jsonc
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "apmix/gpt-5.6-luna",
  "provider": {
    "apmix": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "apmix",
      "options": { "baseURL": "https://api.apmix.ai/v1", "apiKey": "apx_live_YOUR_KEY" },
      "models": {
        "gpt-5.6-luna": { "name": "GPT 5.6 Luna", "tool_call": true },
        "claude-sonnet-5": { "name": "Claude Sonnet 5", "tool_call": true }
      }
    }
  }
}

Restart the CLI, run kilo in your project and choose a model with /models.

Which model should you pick?

Any model in your plan works in all four tools, so pick by the job, not by the tool:

JobTry
Everyday coding, fast iterationsgpt-5.6-luna, deepseek-v4-flash, gemini-3.8-flash
Hard problems and large refactorsclaude-opus-5, gpt-6-sol, gemini-3.1-pro
Long agent sessions on a budgetdeepseek-v4-flash, kimi-k3, glm-5.3

Every model has a weighted-token multiplier, so a fast model makes your allowance go further. The pricing page turns each plan's allowance into real tokens per model, and the live ranking shows what other developers run most right now.

Other tools

Pi, Kimi Code, Grok Build, DeepSeek Harness, Hermes and ZCode have their own recipes in the docs, and so does Claude Code. If your tool is not listed, look for a Base URL or Custom provider field: paste https://api.apmix.ai/v1 and your key, and use a model id from the catalog.

A black terminal window floating in space, a glowing prompt connected by fine lines to small glass cubes.

Guides3 min read

How to set up Claude Code with apmix in two minutes

Point Claude Code at apmix with three environment variables, make it permanent in settings.json, switch between Claude Sonnet, Opus and Haiku with /model, and keep an eye on your usage.

One key for every top model.

GPT, Claude, Gemini, Grok, DeepSeek and Qwen on a single API key and one monthly plan. Works with the tools you already use.

10M free tokens at sign-up, no card needed.