Codex CLI and OpenCode with MixMedia
In short: take an API key from the Dashboard and use the base URL https://api.mixmedia.tech/v1 in one of two ways. Codex CLI: install it with npm, create the ~/.codex folder (%USERPROFILE%\.codex on Windows), put config.toml and auth.json with your key there and run codex. OpenCode in VS Code or the terminal: create ~/.config/opencode/opencode.json with the same key and URL and launch the editor or CLI. Both setups are tested on a live run: file edits, commands, streaming.
Get an API key
Sign in at mixmedia.tech, open Dashboard → API keys and click “Create key”. The key starts with sk-aim-. It is the same key as for images and video, with one shared balance.
Top up in Dashboard → Balance. No subscription: you pay only for the tokens the model actually used.
Choose how to connect
Option A: Codex CLI (terminal)
Install Codex CLI
You need Node.js 18+. Then run in your terminal (PowerShell on Windows):
npm install -g @openai/codexCodex CLI is OpenAI’s official tool for coding with AI right from the terminal: it reads the project, edits files and runs commands. Check: codex --version. Already installed? The same command updates it.
Create the configuration folder
macOS / Linux:
mkdir -p ~/.codexWindows: press Win + R, type %USERPROFILE%\.codex and hit Enter. If the folder does not exist, create it by hand or with PowerShell:
New-Item -ItemType Directory -Force "$env:USERPROFILE\.codex" | Out-NullConfigure the files
File 1: config.toml
| System | Path |
|---|---|
| Windows | %USERPROFILE%\.codex\config.toml |
| macOS / Linux | ~/.codex/config.toml |
Paste exactly this at the very top of the file:
model_provider = "mixmedia"
model = "gpt-6.1-sol"
review_model = "gpt-6.1-sol"
model_reasoning_effort = "high"
[model_providers.mixmedia]
name = "MixMedia"
base_url = "https://api.mixmedia.tech/v1"
wire_api = "responses"
requires_openai_auth = true| Line | Meaning |
|---|---|
model_provider | which provider block below to use |
model / review_model | model for work and for /review |
model_reasoning_effort | reasoning depth: low, medium, high, xhigh |
base_url | https://api.mixmedia.tech/v1 |
wire_api | responses — Codex only speaks the Responses API |
requires_openai_auth | read the key from auth.json |
File 2: auth.json
| System | Path |
|---|---|
| Windows | %USERPROFILE%\.codex\auth.json |
| macOS / Linux | ~/.codex/auth.json |
Paste exactly this:
{
"OPENAI_API_KEY": "sk-aim-YOUR_KEY"
}sk-aim-YOUR_KEY with the key from Dashboard → API keys.Instead of writing auth.json by hand you can save the key with a command (Codex writes the file itself):
echo sk-aim-YOUR_KEY | codex login --with-api-keyIf you signed in to Codex with ChatGPT before, auth.json already exists: replace its whole content.
Launch Codex CLI
cd your-project
codexThe header should show model: gpt-6.1-sol and provider: mixmedia. A one-shot task without the chat:
codex exec "create hello.py that prints hi and run it"| Command | What it does |
|---|---|
/model | switch model and reasoning depth |
codex -m gpt-6-astra | start with another model |
codex resume --last | continue the last session |
/review | review the changes in the repo |
Models for Codex
| Model | ID | Input / 1M | Output / 1M | Cache read / 1M |
|---|---|---|---|---|
| GPT-6 Astra | gpt-6-astra | $10.4 | $52 | $1.04 |
| GPT-6.1 Sol | gpt-6.1-sol | $2.08 | $10.4 | $0.104 |
| GPT-6.2 Sol | gpt-6.2-sol | $2.08 | $10.4 | $0.104 |
| GPT-6.2 Astra | gpt-6.2-astra | $8.32 | $41.6 | $0.416 |
| GPT-5.6 | gpt-5.6 | $4.16 | $20.8 | $0.416 |
| DeepSeek V4 Pro | deepseek-v4-pro | $0.6686 | $2.0058 | $0.0669 |
| DeepSeek V4.1 Flash | deepseek-v4.1-flash | $0.1486 | $0.5942 | $0.0149 |
Prices for Claude Code, Codex, Gemini CLI, OpenCode, Cline and similar coding tools. The same models via a regular API call cost a bit more. Cache-read price depends on the model (see the table). Cache write is 1.25× the input price in the same column. A 1-hour cache write is 2× input for Claude and 2.5× input for GPT. Long context: Claude Haiku 5.5: prompts over 100k tokens — coding $0.52 / $2.6, direct API $0.6 / $3; GPT-6 Astra: prompts over 272k tokens — coding $20.8 / $78, direct API $24 / $90; GPT-6.1 Sol: prompts over 272k tokens — coding $4.16 / $15.6, direct API $4.8 / $18; GPT-6.2 Sol: prompts over 272k tokens — coding $4.16 / $15.6, direct API $4.8 / $18; GPT-6.2 Astra: prompts over 272k tokens — coding $16.64 / $62.4, direct API $19.2 / $72; GPT-5.6: prompts over 272k tokens — coding $8.32 / $31.2, direct API $9.6 / $36.
Codex works with GPT only. Best picks: gpt-6.1-sol (fast and cheap) and gpt-6-astra (strongest). With gpt-5.6 Codex prints “Model metadata … not found” and runs without its own file-patch tool, so use it in OpenCode instead. For Claude and Gemini use Claude Code, Gemini CLI or OpenCode.
Codex in VS Code
The Codex extension for VS Code, Cursor and Windsurf (Ctrl+Shift+X → “Codex” by OpenAI) reads the same config.toml and auth.json, so nothing else to set up after step 3. If it offers a ChatGPT sign-in, close it and restart the editor.
Troubleshooting
Codex asks to sign in with ChatGPT
The line model_provider = "mixmedia" must be at the very top of config.toml, before [model_providers.mixmedia], and auth.json must hold your key. Check: codex login status.
“Codex is ignoring 1 unrecognized configuration setting”
config.toml still has a line from old guides, e.g. disable_response_storage or windows_wsl_setup_acknowledged. Current Codex versions do not know them and already send requests with store: false. Delete the line. Check the file: codex exec --strict-config "ok".
401 Unauthorized
The key in auth.json is incomplete or deleted. Create a new one in the Dashboard.
402 / insufficient balance
Top up in Dashboard → Balance.
«The Responses API is available for GPT models»
A Claude or Gemini model is set in Codex. Use gpt-6.1-sol or gpt-6-astra.
Option B: OpenCode (VS Code extension / CLI)
Install OpenCode
OpenCode comes as a terminal app, a VS Code extension and a desktop app. All three read the same config file. The terminal version needs Node.js 18+:
npm install -g opencode-aiVS Code extension: Ctrl+Shift+X → search “opencode” → Install. Check: opencode --version.
Create the config file
| System | Path |
|---|---|
| Windows | %USERPROFILE%\.config\opencode\opencode.json |
| macOS / Linux | ~/.config/opencode/opencode.json |
Create the folder if it does not exist; OpenCode does not create the file itself:
mkdir -p ~/.config/opencodeNew-Item -ItemType Directory -Force "$env:USERPROFILE\.config\opencode" | Out-NullThe exact path on your machine: opencode debug paths, line config.
Configure opencode.json
Paste exactly this. OpenCode’s built-in OpenAI provider talks to our URL over the Responses API, like Codex:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"openai": {
"options": {
"baseURL": "https://api.mixmedia.tech/v1",
"apiKey": "sk-aim-YOUR_KEY"
},
"models": {
"gpt-6.1-sol": {
"name": "GPT-6.1 Sol (MixMedia)",
"limit": { "context": 272000, "output": 128000 },
"options": { "store": false },
"variants": { "low": {}, "medium": {}, "high": {}, "xhigh": {} }
},
"gpt-6-astra": {
"name": "GPT-6 Astra (MixMedia)",
"limit": { "context": 272000, "output": 128000 },
"options": { "store": false },
"variants": { "low": {}, "medium": {}, "high": {}, "xhigh": {} }
},
"gpt-5.6": {
"name": "GPT-5.6 (MixMedia)",
"limit": { "context": 272000, "output": 128000 },
"options": { "store": false },
"variants": { "low": {}, "medium": {}, "high": {}, "xhigh": {} }
}
}
}
},
"agent": {
"build": { "options": { "store": false } },
"plan": { "options": { "store": false } }
}
}sk-aim-YOUR_KEY with the key from Dashboard → API keys.variants are reasoning levels you can switch in OpenCode (or --variant high on the command line). "store": false turns off server-side response storage. To add Claude, put the anthropic block from the OpenCode guide next to it.
| Model | ID | Input / 1M | Output / 1M | Cache read / 1M |
|---|---|---|---|---|
| GPT-6 Astra | gpt-6-astra | $10.4 | $52 | $1.04 |
| GPT-6.1 Sol | gpt-6.1-sol | $2.08 | $10.4 | $0.104 |
| GPT-6.2 Sol | gpt-6.2-sol | $2.08 | $10.4 | $0.104 |
| GPT-6.2 Astra | gpt-6.2-astra | $8.32 | $41.6 | $0.416 |
| GPT-5.6 | gpt-5.6 | $4.16 | $20.8 | $0.416 |
| DeepSeek V4 Pro | deepseek-v4-pro | $0.6686 | $2.0058 | $0.0669 |
| DeepSeek V4.1 Flash | deepseek-v4.1-flash | $0.1486 | $0.5942 | $0.0149 |
Prices for Claude Code, Codex, Gemini CLI, OpenCode, Cline and similar coding tools. The same models via a regular API call cost a bit more. Cache-read price depends on the model (see the table). Cache write is 1.25× the input price in the same column. A 1-hour cache write is 2× input for Claude and 2.5× input for GPT. Long context: Claude Haiku 5.5: prompts over 100k tokens — coding $0.52 / $2.6, direct API $0.6 / $3; GPT-6 Astra: prompts over 272k tokens — coding $20.8 / $78, direct API $24 / $90; GPT-6.1 Sol: prompts over 272k tokens — coding $4.16 / $15.6, direct API $4.8 / $18; GPT-6.2 Sol: prompts over 272k tokens — coding $4.16 / $15.6, direct API $4.8 / $18; GPT-6.2 Astra: prompts over 272k tokens — coding $16.64 / $62.4, direct API $19.2 / $72; GPT-5.6: prompts over 272k tokens — coding $8.32 / $31.2, direct API $9.6 / $36.
Launch and pick a model
cd your-project
opencodeIn VS Code restart the editor and open OpenCode in the left sidebar. The desktop app picks up the same opencode.json.
One-shot: opencode run -m openai/gpt-6.1-sol "fix the bug in calc.py"
| Command | What it does |
|---|---|
/models | switch model (look for “MixMedia”) |
@файл | attach a file to the prompt |
/help | all commands |
/exit | quit |
Troubleshooting
MixMedia models are missing in /models
Check the path from opencode debug paths and that the file is valid JSON (no trailing comma).
401
The key in apiKey is incomplete. Copy it again from the Dashboard.
"store": false in the config above. Per-request usage is in the Dashboard.FAQ
Can I use Codex CLI from Russia?
Yes. Point Codex CLI at https://api.mixmedia.tech with your MixMedia key. It works without a VPN and without an Anthropic, OpenAI or Google account.
How do I pay from Russia?
Top up your MixMedia balance with a Russian bank card, SBP or SberPay (from $5). No foreign card needed; tokens are charged from the balance.
Do I need a VPN?
No. api.mixmedia.tech is reachable from Russia directly, both for the CLI and for the VS Code extensions.
How much does it cost?
For coding tools such as Codex CLI, from $0.104 per 1M input tokens depending on the model; cache-read prices are in the table on this page. A regular API call (not from a coding tool) costs a bit more. Full list: api.mixmedia.tech/v1/models.
How is it different from the official API?
Same models and the same API format, so the tools work unchanged. The difference is payment and access: Russian cards and SBP, no VPN, one key for Claude, GPT and Gemini. Prices are per token and may be higher than the official list price.
How do I get a key?
Sign in at mixmedia.tech, open Dashboard → API keys, click “Create key” and top up the balance.
Other tools
Questions? Telegram @mixmedia_robot.