Skip to content

Integrations

Use Codex CLI with any model

Codex CLI reads custom model providers from its ~/.codex/config.toml file. Connect to Hopscotch to use any model in the catalog.

Set it up

  1. 01

    The configuration surface

    The file is ~/.codex/config.toml, with a project-scoped .codex/config.toml alongside it. Add a provider and select it:

    ~/.codex/config.toml
    model_provider = "hopscotch"
    model = "unirouter/auto"
    
    [model_providers.hopscotch]
    name = "Hopscotch"
    base_url = "https://api.hopscotchlabs.ai/v1"
    env_key = "HOPSCOTCH_API_KEY"
    wire_api = "responses"
    bash
    export HOPSCOTCH_API_KEY=ub_live_XXXXXXXXXXXX

    base_url must include /v1. Codex appends only /responses to whatever you give it, so a base URL that stops at the hostname posts to /responses and receives a 404.

    Do not name the provider openai. The built-in provider ids are reserved and a block of that name is ignored rather than refused, which is the kind of failure that costs an afternoon. Any other id works; hopscotch above is arbitrary.

  2. 02

    The key comes from a variable you name

    env_key names the environment variable Codex reads, and it reads it at request time rather than caching it.

    Codex also has a login flow that writes a credential to ~/.codex/auth.json. That path belongs to the built-in OpenAI provider and is not how a custom provider is authenticated; leave it alone and use env_key.

  3. 03

    Pin the model id

    Codex's model field is free text and this API needs it to name a provider, so the default has to change before the first request.

    There is one more model setting, review_model, which /review uses and which defaults to the session model. If you set it, pin it the same way.

Models that fit an agent

These models support tool calling and take at least 128K tokens of context. Prices are per million tokens.

ModelContextMax outputInput /1MOutput /1MCached input /1MProvidersReleased
GoogleGemma 4 E4B ITGoogledeepinfra/gemma-4-E4B-it131K8K$0.02$0.10n/aDeepinfra2 Apr 2026
OpenAIGPT OSS 20BOpenAIdeepinfra/gpt-oss-20b131K16K$0.03$0.14n/aDeepinfra5 Aug 2025
OpenAIGPT OSS 120BOpenAIdeepinfra/gpt-oss-120b131K16K$0.04$0.17n/aDeepinfra5 Aug 2025
Command R7BCoherecohere/command-r7b-12-2024128K4K$0.04$0.15$0.04Cohere2 Dec 2024
Nemotron 3 Nano 30B A3BNVIDIAdeepinfra/Nemotron-3-Nano-30B-A3B262K262K$0.05$0.20n/aDeepinfra15 Dec 2025
DeepSeekDeepSeek V4 Flash 0731DeepSeekdeepinfra/DeepSeek-V4-Flash-07311M384K$0.06$0.18n/aDeepinfra31 Jul 2026

What changes when Codex CLI runs through Hopscotch

One key for every model
Switch models in Codex CLI by changing the model name.
A budget for this tool
Give Codex CLI its own key with a daily limit. A long session stops at the limit.
Every call in Activity
Each request Codex CLI sends shows up with its model, provider, tokens and cost.
List price
You pay each provider's list price per token, with no markup.

Codex CLI questions

Do I need an account with each provider?

No. One Hopscotch key covers every model in the catalog, and you buy credit once.

Which model name goes in Codex CLI?

The ID from the models page, such as deepinfra/gemma-4-E4B-it. The provider comes first, then the model.

Will Codex CLI get a different model than the one I picked?

No. Hopscotch runs the model you name. To add a backup, set up a routing profile.

Can I use my own provider key with Codex CLI?

Yes. Add the key in your dashboard. Requests to that provider run on it.

Run Codex CLI on any model

Get a key and paste the config above.