Get stock Codex CLI driving open-weight models against Tensormesh in 5 minutes. Every Tensormesh serverless model supports the full Codex flow today (chat + tool use);Documentation Index
Fetch the complete documentation index at: https://docs.tensormesh.ai/llms.txt
Use this file to discover all available pages before exploring further.
MiniMaxAI/MiniMax-M2.5 is the recommended default.
Quick Links
Sign up / Log in
Create your Tensormesh account with Google or GitHub.
Get an API key
Generate an
ak-... key under Profile → API keys.Install Codex CLI
npm install -g @openai/codex — verified against Codex 0.128+.Supported models
Full matrix of Codex-ready models on Tensormesh serverless.
Get support
Email saas-support@tensormesh.ai for help.
TL;DR
Three steps — install the CLI, configure the provider, set the API key — then runcodex. Step 2 has an ordering constraint (top-level keys must precede any [section] header); see Setup below if you have an existing ~/.codex/config.toml.
Prerequisites
- Codex CLI installed via
npm install -g @openai/codex. Verified against0.128.0through0.131.0(chat + tool use end-to-end); forward-compatible with later versions barring upstream Codex breaking changes. - A Tensormesh account with an API key (
ak-...). Sign up, then visit Profile → API keys. - macOS or Linux, bash or zsh. Windows binaries ship in Codex 0.131+ but aren’t currently tested by Tensormesh.
You do not need to run
codex login. The provider’s env_key field tells Codex to read your API key from the environment variable directly; the OAuth login flow is for OpenAI-hosted models only.You do not need to run any local infrastructure. Tensormesh handles Codex compatibility server-side, so stock
codex pointed at serverless.tensormesh.ai (per the TL;DR above) is the complete setup.Supported models
| Model | Codex CLI status | Notes |
|---|---|---|
MiniMaxAI/MiniMax-M2.5 | ✓ chat + tool use | Recommended default; 192K context |
openai/gpt-oss-120b | ✓ chat + tool use | Reasoning + tools, 128K context |
openai/gpt-oss-20b | ✓ chat + tool use | Reasoning + tools, 128K context |
Qwen/Qwen3-235B-A22B | ✓ chat + tool use | Reasoning + tools, 40K context |
Qwen/Qwen3-30B-A3B | ✓ chat + tool use | Reasoning + tools, 40K context |
Qwen/Qwen3-Coder-30B-A3B-Instruct | ✓ chat + tool use | Coding-tuned, 256K context |
Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8 | ✓ chat + tool use | Coding-tuned, 256K context |
mistralai/Devstral-2-123B-Instruct-2512 | ✓ chat + tool use | Mistral-architecture coder, 32K context |
moonshotai/Kimi-K2.6 | ✓ chat + tool use | Reasoning + tools, 32K context |
/v1/chat/completions as well. Codex CLI specifically cannot fall back to that wire (see openai/codex#7782 for OpenAI’s rationale), which is why the matrix above is Codex-CLI specific.
Switching models
The Codex TUI’s/model picker only shows OpenAI’s built-in lineup (gpt-5.5, gpt-5.4, …) — Tensormesh model slugs aren’t in it. Likewise, the “GPT-5.5 is now available” tip on launch refers to models you can’t use here. Press Esc to dismiss the picker and switch models via one of the methods below.
This is a Codex CLI limitation that affects every third-party provider; it’s not specific to Tensormesh.
Per-invocation (no config edit)
-m is a per-invocation override; your config.toml default is unchanged. Equivalent long form: codex -c 'model="..."'.
Change the default
Edit~/.codex/config.toml and update the model = line, or use sed:
-i on Linux: sed -i 's|...|' ~/.codex/config.toml.)
Optional: shell aliases for frequent switching
If you switch models often, add aliases to your~/.zshrc (zsh) or ~/.bashrc (bash):
tm-coder from any directory to start a Codex session against that model. Exit codex (/exit or Ctrl-D twice) and run a different alias to switch.
Setup
The three steps from the TL;DR, with explanation.Install Codex CLI
codex command to your global node_modules/bin. Verify with codex --version.Configure the Tensormesh provider
Codex reads provider configuration from The first three keys make Tensormesh + MiniMax + medium reasoning the default for every
~/.codex/config.toml. Add this content:codex invocation. The [model_providers.tensormesh] block defines the provider those defaults reference. You can override per-invocation with -c.- Fresh config (file missing or empty)
- Merge into existing config
Just paste the block as-is — the TL;DR’s
cat > ~/.codex/config.toml does this.Set your API key
~/.zshrc (zsh) or ~/.bashrc (bash) to persist across sessions. The API key prefix selects environment: ak-dev-... for dev, ak-staging-... for staging, ak-live-... for production.Don’t have a key yet? Generate one in your profile.Usage
Slash commands in TUI
Inside an interactivecodex session, type / to bring up the command picker (autocomplete). /help is not a valid command — typing it gives Unrecognized command '/help'.
A few that customers reach for most often:
| Command | What it does |
|---|---|
/status | Session config + token usage display |
/compact | Manually summarize history to free up context |
/init | Generate an AGENTS.md for the current repo |
/diff | Show git diff in the conversation |
/copy | Copy the last response as markdown |
/exit | Quit cleanly (also Ctrl-D twice) |
/ and arrow through the picker.
Sandbox / approval modes
Codex defaults to a strict sandbox: read-only, no network, prompts before each shell command. Three modes are available:| Mode | Network | Shell approval | When to use |
|---|---|---|---|
| (no flag) | no | Prompts before each command | Reading code, exploring; safest |
-s workspace-write -a never | no | Auto-approves; writes allowed inside workdir | Normal coding; the most common daily mode |
--dangerously-bypass-approvals-and-sandbox | yes | Auto-approves all commands; no sandbox | Only on a trusted machine, for prompts you’ve reviewed |
codex exec (non-interactive), the -a never flag is implicit, so just codex exec -s workspace-write is sufficient.
The -s workspace-write and --dangerously-bypass-approvals-and-sandbox configurations are mutually exclusive in effect — workspace-write sandboxes filesystem writes and disables network. If you need network access for a tool, use the bypass flag.
Codex CLI 0.128.0 removed the older
--full-auto shortcut. Use -s workspace-write (+ -a never for interactive) instead. If you copy a snippet that uses --full-auto, Codex will error with unexpected argument '--full-auto' found.Resume gotcha — --last orders by file mtime
codex exec resume --last picks the session whose JSONL file was most recently modified, not the one most recently created. So if you just touched an older session (even by reading or resuming it once), that session — not your latest one — wins --last. To target a specific session, pass its UUID explicitly:
~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl filenames.
Recommended settings
model_reasoning_effort = "medium"is the empirical sweet spot for MiniMax-M2.5. The full set Codex accepts isnone/minimal/low/medium/high/xhigh. Against MiniMax-M2.5,highdoes not consistently improve output quality, costs more latency, and occasionally produces self-contradicting reasoning chains in long generations. Usenoneorminimalonly when you specifically want to skip the model’s reasoning step. This recommendation is calibrated only for MiniMax-M2.5. For the other supported models,mediumis a reasonable starting point but not validated; experiment if you’re optimizing for a specific workload.- Stay in
-s workspace-writefor most coding work. Switch to the bypass flag only for tasks that need network access (e.g., fetching docs, hitting an API).
Known cosmetic issues
”Model metadata not found” warning in TUI
When you run interactivecodex (TUI), you’ll see this between every user message and the model’s response:
gpt-5.5, gpt-5.4, …); when it sees a slug that isn’t in the registry it falls back to default metadata and emits this warning. Tensormesh model slugs (MiniMax, Qwen3, etc.) are not in OpenAI’s registry, so the warning fires for every supported model here.
The warning does not appear in codex exec (non-interactive) runs — only in TUI. It’s a Codex CLI behavior, not a Tensormesh behavior; the same applies to every other third-party provider.
Auto-compact threshold
Codex automatically compacts conversation history when it approaches the model’s context window. The exact trigger varies per model, and the threshold is configurable via Codex’sauto_compact_token_limit setting:
| Model | Context window |
|---|---|
MiniMaxAI/MiniMax-M2.5 | 192K (196,608) |
openai/gpt-oss-120b / gpt-oss-20b | 128K (131,072) |
Qwen/Qwen3-235B-A22B / Qwen3-30B-A3B | 40K (40,960) |
Qwen/Qwen3-Coder-30B-A3B-Instruct / Coder-480B-A35B-Instruct-FP8 | 256K (262,144) |
mistralai/Devstral-2-123B-Instruct-2512 | 32K (32,768) |
moonshotai/Kimi-K2.6 | 32K (32,768) |
- In TUI mode: a visible “compacting…” event between turns.
- In
execmode: silent — the compact-trigger turn just takes longer (around 30–60 seconds extra) and the next turn proceeds with the compressed context. No explicit message is printed.
- ✓ Preserved: the topical context of the conversation (documents you’ve fed to Codex, the high-level task you’re working on).
- ✗ Lost: specific conversational facts you told Codex (“remember the codeword BLUEFISH42”). After compaction, Codex sees a summary of earlier turns, not the verbatim history. If specific recall matters for your workflow, plan for compaction or split into fresh sessions.
/compact in the TUI. Otherwise, start a fresh session.
Troubleshooting
When a request fails, Codex retries five times before surfacing the cause:The five
Reconnecting... lines are noise. The meaningful error is the line immediately after 5/5.| Symptom (substring of the meaningful error line) | Likely cause | Fix |
|---|---|---|
command not found: codex | Codex CLI not installed | npm install -g @openai/codex |
Missing environment variable: TENSORMESH_INFERENCE_API_KEY | Variable not exported in the current shell | export TENSORMESH_INFERENCE_API_KEY=ak-...; persist in ~/.zshrc / ~/.bashrc |
We're currently experiencing high demand, which may cause temporary errors (after 5 retries) | Most often an invalid or wrong-environment API key (auth failures are reported as 5xx, which Codex retries before surfacing). Less often, a transient capacity event. | Verify your key against your account and confirm the ak-<env>-... prefix matches your target environment. Quick check: curl -sS -H "Authorization: Bearer $TENSORMESH_INFERENCE_API_KEY" https://serverless.tensormesh.ai/v1/models. If it errors, the key is the problem. |
404 Not Found / Model '<slug>' not found (or) 400 Bad Request / The '<slug>' model is not supported when using Codex with a ChatGPT account | Wrong model slug, or base_url typo in config.toml. The 404 means Tensormesh doesn’t recognize the slug; the 400 is from Codex CLI itself rejecting the slug before sending it. Both mean “fix the model name.” | Compare your ~/.codex/config.toml against the snippet in Setup; curl $base_url/models to list what’s actually available; or check the Supported models matrix. |
404 Not Found / Model '<slug>' not found but the slug appears in curl $base_url/models | The model is temporarily cold (no instance running). | Wait 30–60 seconds and retry — a request will warm the model. After warm-up, subsequent requests are typically under 5 seconds. |
Operation not allowed: read-only (mid-session) | Codex’s default sandbox is read-only | Restart with codex -s workspace-write -a never for normal coding, or codex --dangerously-bypass-approvals-and-sandbox for full access. |
error: unexpected argument '--full-auto' found | Codex 0.128.0 removed --full-auto | Use -s workspace-write -a never (interactive) or -s workspace-write (codex exec). |
Maximum context length is 196608 tokens (or model-specific limit) | Conversation grew past the model’s context window | Type /compact in TUI, or start a new session. |
codex exec appears to hang printing Reading additional input from stdin... | Codex’s exec mode reads stdin even when the prompt is in argv | Add </dev/null to the command, or press Ctrl-D in the terminal to close stdin. |
5/5) and the output of codex --version.
Rollback / uninstall
To remove Tensormesh from your Codex setup:- Delete the
[model_providers.tensormesh]block (and the three top-levelmodel_provider/model/model_reasoning_effortlines if you added them) from~/.codex/config.toml. - Unset
TENSORMESH_INFERENCE_API_KEYand remove from~/.zshrc/~/.bashrc.

