Codex CLI with Jantaris
You connect Codex CLI (OpenAI's coding agent for the terminal) to Jantaris through the MCP server. Codex keeps writing code with its own model, and Jantaris gives it tools: video, image and music generation, cost estimates, balance and a chat tool to ask Claude, Gemini or DeepSeek for a second opinion. All from one key and one balance.
Can Codex use Jantaris models as its main model?
Not yet. Codex lets you add a custom model provider ([model_providers] in config.toml), but according to the current OpenAI docs the only supported wire_api value is "responses", i.e. the Responses API (/v1/responses). Jantaris offers two chat formats: /v1/chat/completions (OpenAI) and /v1/messages (Anthropic). There is no /v1/responses endpoint, so a config like this:
# DOES NOT WORK - Jantaris has no /v1/responses
[model_providers.jantaris]
name = "Jantaris"
base_url = "https://jantaris.com/v1"
env_key = "JANTARIS_API_KEY"
wire_api = "responses"fails with 404 on the first request. What to do instead:
| You want | Use |
|---|---|
| Generate video and images from Codex | The Jantaris MCP server (this page, below) |
| Ask other models from Codex | The chat tool of the MCP server |
| A terminal agent billed per token from your Jantaris balance | Claude Code - works through /v1/messages |
| An editor running Jantaris models | Cursor, Cline, Roo Code, Continue, OpenCode, Aider - Integrations |
Codex itself stays billed the way it is now: your ChatGPT account or OpenAI key.
Step 1: API key
- Open the dashboard, API keys tab.
- Name:
codex. Monthly limit: the amount the agent may never exceed, e.g.15dollars. - Create key and copy
sk-jt-....
Step 2: environment variable
Codex does not store the key in its config file. It reads it from an environment variable whose name you give it.
macOS and Linux
echo 'export JANTARIS_API_KEY="sk-jt-..."' >> ~/.zshrc # on Linux usually ~/.bashrc
source ~/.zshrcWindows PowerShell
[Environment]::SetEnvironmentVariable("JANTARIS_API_KEY", "sk-jt-...", "User")Close and reopen the terminal so the variable is visible. Check: echo $env:JANTARIS_API_KEY in PowerShell, echo $JANTARIS_API_KEY on macOS and Linux.
Step 3: add the MCP server
Same command on every system:
codex mcp add jantaris --url https://jantaris.com/mcp --bearer-token-env-var JANTARIS_API_KEYOr add it by hand to ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml):
[mcp_servers.jantaris]
url = "https://jantaris.com/mcp"
bearer_token_env_var = "JANTARIS_API_KEY"bearer_token_env_var is the variable name, not the key. On connect Codex sends Authorization: Bearer <value of the variable>.
Step 4: verify
codex mcp list
codex mcp get jantarisYou should see the jantaris server with the URL https://jantaris.com/mcp. Then start codex and type:
Use the get_balance tool from the jantaris server and tell me my balance.If it answers with an amount, you are set.
What to ask Codex
- "The landing page in this repo needs a hero background. Estimate 16:9 in Nano Banana Pro and GPT Image 2.5, pick the cheaper one, generate it and save it as
public/img/hero.webp." - "Make a 5-second 9:16 Seedance 2.5 video: a cup of coffee on a windowsill, morning light. Give me the cost first."
- "Ask claude-sonnet-5 with the chat tool whether this database migration is safe, and show both opinions."
- "Check which video models support 1080p and what 10 seconds costs in each."
Prices for reference: Seedance 2.5 from $0.261 per second, Nano Banana Pro from $0.0747 per image, GPT Image 2.5 $0.0432 per image.
For video the generate tool waits up to 45 seconds. If the clip is not ready, Codex gets a task id and checks it with get_task. Output links are temporary - tell Codex to download the file into the project.
Standing rules for Codex
Codex reads AGENTS.md in your repo. Download the ready Jantaris API description and add your own rules, e.g. "always show the cost before generating". Guide: AGENTS.md file.
Common errors
| Symptom | Cause and fix |
|---|---|
jantaris server does not connect | JANTARIS_API_KEY does not exist in this terminal. Open a new terminal after SetEnvironmentVariable or run source ~/.zshrc |
401 | Key copied with an error or revoked in the dashboard |
402 | Balance too low, top up |
403 | The key hit its monthly limit |
404 after setting model_providers | Codex calls /v1/responses, which Jantaris does not have. Remove [model_providers.jantaris] and stick with MCP |
| Codex does not use the tools | Say it directly: "use the generate tool from the jantaris server" |









