---
title: "How to Use the Codex App with Any Model: GLM 5.1, MiniMax M3, MiMo V2.5 Pro, OpenCode Go"
description: "The Codex app works with more than OpenAI models. Point it at GLM 5.1, MiniMax M3, MiMo V2.5 Pro, or OpenCode Go with a few lines of config.toml and keep coding when your ChatGPT plan runs out."
date: 2026-06-12
categories: ["AI"]
tags: ["ai-tools","codex","llm"]
---

import Button from "@components/widgets/Button.astro";
import Notice from "@components/widgets/Notice.astro";
import ListCheck from "@components/widgets/ListCheck.astro";
import Accordion from "@components/widgets/Accordion.astro";
import Tabs from "@components/widgets/Tabs.astro";
import Tab from "@components/widgets/Tab.astro";

The Codex app is the best coding agent interface I have used so far. Worktrees, automations, the in-app browser, the review flow. Nothing else I run feels this polished. The problem is what happens on Thursday afternoon when my ChatGPT plan hits its weekly limit and the app politely tells me to wait until Monday.

Here is the part most people miss: Codex does not care where the model comes from. The app and the CLI read the same `~/.codex/config.toml`, and that file lets you define custom model providers. Any OpenAI-compatible endpoint works. So when my OpenAI quota runs dry, I switch to GLM 5.1, MiniMax M3, MiMo V2.5 Pro, or my [OpenCode Go subscription](/opencode-go-plan/) and keep working in the same app.

This guide covers the exact configs for all four. Copy, paste your API key, done.

## How Codex talks to other models

Codex stores its configuration in `~/.codex/config.toml`. The [advanced config docs](https://developers.openai.com/codex/config-advanced) describe a `model_providers` table where you define extra endpoints:

```toml
model = "some-model"
model_provider = "my-provider"

[model_providers.my-provider]
name = "My Provider"
base_url = "https://api.example.com/v1"
env_key = "MY_API_KEY"
wire_api = "chat"
```

Three things to know before you start:

<ListCheck>

- `wire_api = "chat"` tells Codex to use the standard Chat Completions format. All four providers below are OpenAI-compatible, so this is what you want.
- `env_key` points at an environment variable, not the key itself. Your API key stays out of the config file.
- You cannot name a custom provider `openai`, `ollama`, or `lmstudio`. Those IDs are reserved for the built-in providers.

</ListCheck>

The Codex app picks up whatever default `model` and `model_provider` you set in `config.toml`. The CLI does too, plus it supports profiles for fast switching (more on that below).

<Notice type="warning" title="One config quirk">
`model_verbosity` and reasoning summaries only work with the Responses API. Providers using `wire_api = "chat"` ignore those settings. Everything else, including approvals, sandboxing, and MCP servers, works the same regardless of provider.
</Notice>

## Option 1: OpenCode Go (12 models, one key)

This is the setup I use most. [OpenCode Go](/opencode-go-plan/) is a $10/month subscription that bundles 12 open source models behind one OpenAI-compatible endpoint: DeepSeek V4, Qwen 3.6, GLM 5.1, MiniMax, Kimi, MiMo, and more. Instead of juggling four provider accounts, you get one key that covers all of them.

<Button text="Get $5 in Free Credits" link="https://go.bitdoze.com/opencode-go" variant="solid" color="green" size="md" icon="arrow-right" />

Add this to `~/.codex/config.toml`:

```toml
model = "glm-5.1"
model_provider = "opencode-go"

[model_providers.opencode-go]
name = "OpenCode Go"
base_url = "https://opencode.ai/zen/go/v1"
env_key = "OPENCODE_API_KEY"
wire_api = "chat"
```

Then export your key:

```bash
export OPENCODE_API_KEY="your-go-key"
```

Swap `model` for any model in the Go lineup: `minimax-m3`, `mimo-v2.5-pro`, `deepseek-v4-pro`, `qwen-3.6-plus`, and so on. The full model list and usage limits are in my [OpenCode Go review](/opencode-go-plan/).

If you only set up one provider from this article, make it this one. One key, 12 models, and the limits reset every 5 hours.

## Option 2: GLM 5.1 (strongest coder)

GLM 5.1 is Z.AI's flagship and the strongest open source coding model right now. It scores 58.4% on SWE-Bench Pro, ahead of GPT-5.4 and Claude Opus 4.6, and it can grind on a single task for hours without drifting. I covered it in depth in the [open source Claude alternatives roundup](/best-open-source-llms-claude-alternative/).

Z.AI sells a GLM Coding Plan starting at $18/month, and the coding endpoint is OpenAI-compatible:

```toml
model = "glm-5.1"
model_provider = "zai"

[model_providers.zai]
name = "Z.AI GLM"
base_url = "https://api.z.ai/api/coding/paas/v4"
env_key = "ZAI_API_KEY"
wire_api = "chat"
```

```bash
export ZAI_API_KEY="your-zai-key"
```

<Button text="Get GLM Coding Plan (10% Off)" link="https://go.bitdoze.com/glm" variant="solid" color="blue" size="md" icon="arrow-right" />

<Notice type="info" title="GLM discount">
Sign up through [go.bitdoze.com/glm](https://go.bitdoze.com/glm) for 10% off the GLM Coding Plans.
</Notice>

## Option 3: MiniMax M3 (cheapest to run)

MiniMax M3 is the newest release in the MiniMax line, and like the M2.7 before it, the pitch is price. This is the model I point Codex at for long refactoring sessions where token count matters more than squeezing out the last benchmark point. MiniMax also offers a Token Plan subscription with discounted rates, which pairs well with always-on agent work.

```toml
model = "MiniMax-M3"
model_provider = "minimax"

[model_providers.minimax]
name = "MiniMax"
base_url = "https://api.minimax.io/v1"
env_key = "MINIMAX_API_KEY"
wire_api = "chat"
```

```bash
export MINIMAX_API_KEY="your-minimax-key"
```

<Button text="MiniMax Token Plan (10% Off)" link="https://go.bitdoze.com/minimax" variant="solid" color="purple" size="md" icon="arrow-right" />

If you are outside the international region and use the mainland China endpoint, swap the base URL for `https://api.minimaxi.com/v1`.

## Option 4: MiMo V2.5 Pro (best for long agent runs)

MiMo V2.5 Pro is Xiaomi's flagship, built for agent workloads with hundreds of tool calls per session and a 1M token context window. In internal testing it built a full SysY compiler in Rust over 4.3 hours and 672 tool calls. It is the model I reach for when I hand Codex a task and walk away for the afternoon.

```toml
model = "mimo-v2.5-pro"
model_provider = "mimo"

[model_providers.mimo]
name = "Xiaomi MiMo"
base_url = "https://api.xiaomimimo.com/v1"
env_key = "MIMO_API_KEY"
wire_api = "chat"
```

```bash
export MIMO_API_KEY="your-mimo-key"
```

<Button text="MiMo Token Plan ($2 Bonus)" link="https://go.bitdoze.com/mimo" variant="solid" color="green" size="md" icon="arrow-right" />

<Notice type="info" title="MiMo bonus">
Sign up through [go.bitdoze.com/mimo](https://go.bitdoze.com/mimo) and get a $2 bonus credit on the MiMo Token Plan. The Lite tier starts at $72/year, and off-peak hours (16:00-24:00 UTC) get an extra 20% discount.
</Notice>

## Switching between providers without editing config.toml

You can keep all four providers in one `config.toml` and only change the two top-level lines (`model` and `model_provider`) when you want to switch. That works, but it gets old fast.

Two better options:

<Tabs>
<Tab name="CLI flags">
Override the provider for a single run:

```bash
codex --config model_provider='"zai"' --config model='"glm-5.1"'
```

Good for quick tests, too verbose for daily use.
</Tab>
<Tab name="Profiles">
Create one profile file per provider. For example `~/.codex/glm.config.toml`:

```toml
model = "glm-5.1"
model_provider = "zai"
```

And `~/.codex/minimax.config.toml`:

```toml
model = "MiniMax-M3"
model_provider = "minimax"
```

Then launch with:

```bash
codex --profile glm
codex --profile minimax
```

The profile file overlays your base config, so the `[model_providers]` tables you already defined stay available. Note that since Codex 0.134.0, profiles live in separate files, not under `[profiles.name]` in the main config.
</Tab>
</Tabs>

My setup: OpenCode Go is the default in `config.toml`, and I keep a `glm` profile for the days I want GLM 5.1 through Z.AI directly with the bigger coding plan limits.

## What still needs your OpenAI account

Custom providers cover local work: the app, the CLI, the IDE extension, file edits, terminal commands, MCP servers. Some pieces stay tied to OpenAI auth:

- Codex cloud tasks and the web environment run on OpenAI infrastructure with your ChatGPT login
- The GitHub integration for cloud-delegated work expects an OpenAI-backed account
- Reasoning summaries and `model_verbosity` need the Responses API, which these chat-based providers do not use

In practice this has not bothered me. I use the app locally, and local is exactly where custom providers work.

## Which one should you pick?

| Provider | Cost | Best for |
|----------|------|----------|
| OpenCode Go | $10/month | One key, 12 models, easiest start |
| GLM 5.1 | from $18/month | Strongest coding, long autonomous tasks |
| MiniMax M3 | Token Plan | Cheapest daily driver, high-volume work |
| MiMo V2.5 Pro | from $72/year | 1M context, marathon agent sessions |

If you want the longer comparison with benchmarks and per-token pricing, the [best open source LLMs roundup](/best-open-source-llms-claude-alternative/) covers GLM 5.1, MiniMax, MiMo, and three others side by side.

<Accordion label="Does this work with the Codex app or just the CLI?" group="faq">
Both. The app, the CLI, and the IDE extension all read the same `~/.codex/config.toml`. Set `model` and `model_provider` there and the app uses your custom provider. Profiles (`--profile`) are a CLI feature, so for the app you set the default in the main config.
</Accordion>

<Accordion label="Will my ChatGPT subscription still work after adding custom providers?" group="faq">
Yes. Adding `[model_providers]` entries does not touch your OpenAI login. Switch back anytime by setting `model_provider` to the built-in default or removing the line.
</Accordion>

<Accordion label="Can I put these providers in a project .codex/config.toml?" group="faq">
No. Codex ignores `model_provider` and `model_providers` in project-local config files for security reasons. Provider definitions belong in your user-level `~/.codex/config.toml`.
</Accordion>

<Accordion label="Is one OpenCode Go key enough, or do I need direct provider accounts?" group="faq">
Go covers GLM 5.1, MiniMax, and MiMo models under its $12/5-hour usage cap, which I have rarely hit. Direct accounts make sense when you want the bigger limits of a dedicated coding plan, like GLM's $18/month tier for heavy GLM 5.1 use.
</Accordion>

## Wrapping up

The Codex app stopped being an OpenAI-only tool the moment custom providers landed in `config.toml`. Ten lines of TOML and an API key get you GLM 5.1, MiniMax M3, MiMo V2.5 Pro, or all 12 OpenCode Go models inside the same interface you already use. My ChatGPT plan still does the heavy thinking early in the week. After that, the open source models take over, and honestly, for most coding tasks I cannot tell the difference.

<Button text="Try OpenCode Go ($5 Free Credits)" link="https://go.bitdoze.com/opencode-go" variant="solid" color="green" size="md" icon="arrow-right" />

## Related articles

- [OpenCode Go: 12 AI Coding Models for $10/Month](/opencode-go-plan/) — the subscription I use as my Codex fallback
- [Best Open Source LLMs to Replace Opus 4.7 or GPT-5.5](/best-open-source-llms-claude-alternative/) — benchmarks and pricing for GLM 5.1, MiniMax, MiMo, and more
- [Best Cheap Models for AI Coding Agents](/best-cheap-models-hermes-agent/) — per-token pricing breakdown
- [GitHub Copilot Alternatives After the June 2026 Pricing Change](/github-copilot-alternatives-2026/) — more ways to cut AI coding costs