Integration · Agent

Use DeepSeek, OpenRouter or any model in Codex

Codex is OpenAI’s coding agent and talks to its model over the Responses API. AutoJev gives it a local Responses endpoint, then routes each request to the model you pick — converting to Chat Completions or Anthropic Messages when the provider needs it.

  • One click writes ~/.codex/config.toml
  • Responses in, Chat or Messages out
  • Every selected model and route in one catalog
  • Original config restored on disconnect

Agents

+ Agent

CodexResponses

~/.codex/config.toml

Connected

Claude CodeMessages

~/.claude/settings.json

Connected

Gemini CLIGemini

~/.gemini/settings.json

Connected

OpenCodeChat

~/.config/opencode/opencode.json

Connect

Why Codex needs a protocol adapter

Codex sends requests in the OpenAI Responses format. Many providers you might want to use — DeepSeek, most OpenAI-compatible hosts, Ollama — only speak Chat Completions, and some only speak Anthropic Messages. Pointing Codex straight at them does not work.

AutoJev sits in between on http://127.0.0.1:9527/v1. Codex keeps speaking Responses; the gateway looks at the upstream API type you set on each model and converts the request and the streamed reply in both directions, including function tools, Responses custom tools, images and usage. If the model already speaks Responses, the request passes through without conversion.

Because the conversion is per model, you can mix providers freely: a route can fail over from an OpenAI model to a DeepSeek model and Codex never notices the protocol changed.

What AutoJev configures

ItemValue
Config file~/.codex/config.toml
Model catalog~/.codex/autojev-models.json (via model_catalog_json)
Provider entry[model_providers.autojev] with base_url http://127.0.0.1:9527/v1
Wire protocolwire_api = "responses"
Request labelx-autojev-agent = "codex" header, so logs show the agent
Hosted web searchweb_search = "disabled" (not portable to Chat or Messages models)

Detection alone never changes files. AutoJev only edits the config when you click Connect, and backs up the original first.

Set up Codex with AutoJev

  1. 1

    Install AutoJev

    Download the desktop app for macOS, Windows or Linux and open it. The gateway starts on http://127.0.0.1:9527.

  2. 2

    Add a provider

    On Providers, pick a preset such as DeepSeek, OpenRouter, OpenAI or Ollama, or add any OpenAI-compatible or Anthropic-compatible endpoint. Paste your own API key and run the provider test.

  3. 3

    Add models and, optionally, a route

    Add the models you want with their upstream API type. To let AutoJev choose per request, create a route such as fast or cheap with a load-balancing or intelligent-selection strategy. Routes appear to agents as autojev/<route-id>; single models as <provider>/<model_id>.

  4. 4

    Connect Codex

    Open Agents. AutoJev detects Codex if the codex executable is on your PATH. Select one or more models or routes, choose the default, and click Connect.

  5. 5

    Run Codex

    Start a new Codex session. Requests go to AutoJev, show up in Logs labeled codex, and are routed to the model you chose.

    bash
    codex

The config AutoJev writes

This is the part of config.toml AutoJev sets (default route autojev/fast shown). Everything else in your file is left as it is.

~/.codex/config.toml
# ~/.codex/config.toml — keys AutoJev writes on connect model = "autojev/fast" model_provider = "autojev" model_catalog_json = "/Users/you/.codex/autojev-models.json" web_search = "disabled" [model_providers.autojev] name = "AutoJev" base_url = "http://127.0.0.1:9527/v1" wire_api = "responses" [model_providers.autojev.http_headers] x-autojev-agent = "codex"

Switching models and routes

Every model and route you selected on the Agents page is written to ~/.codex/autojev-models.json, and the default one becomes the model key. To change the default or the list, update the selection on the Agents page and reconnect, or use “Batch update configurations” to refresh every connected agent at once. Restart Codex so it reloads its model list.

If you connect a route instead of a single model, you rarely need to touch Codex again: change the route’s strategy, candidates or weights in AutoJev and the next request follows the new rule.

Restoring your Codex config

Click Disconnect, choose “Stop and restore configurations”, or quit AutoJev from the tray, and AutoJev reverts the keys it wrote and removes autojev-models.json. Values you changed yourself after connecting are kept. On the next launch, AutoJev reconnects Codex unless you disconnected it manually.

Limits to know

  • Conversion cannot add tools, vision or reasoning to a model that lacks them — pick models with tool support for agent work.
  • previous_response_id, hosted tools, and audio or file content are rejected when a request has to be converted.
  • Reasoning (thinking) blocks are dropped during conversion.
  • The gateway must be running for Codex to work while connected; pausing it rejects new requests.

Frequently asked questions

Can I use DeepSeek in Codex?

Yes. Add the DeepSeek preset in AutoJev, add a DeepSeek model with the Chat Completions API type, and connect Codex. AutoJev converts Codex’s Responses requests to Chat Completions and converts the replies back.

How do I use OpenRouter models with Codex?

Add the OpenRouter preset with your OpenRouter key, add the model IDs you want, then select them for Codex on the Agents page. Each one shows up in Codex as <provider>/<model_id>, or you can group them in a route.

Does Codex need a real API key after connecting?

No. Codex talks to the local gateway; your provider keys stay in AutoJev and requests go straight from your machine to the provider. AutoJev adds no markup.

Why is web search disabled after connecting?

Hosted search is an OpenAI-side tool and does not exist on Chat Completions or Messages models, so AutoJev sets web_search = "disabled". Your original value comes back when you disconnect.

Can Codex use a local Ollama model?

Yes. Add the Ollama preset (http://127.0.0.1:11434), add a model, and connect. Pick a model with tool support, since Codex relies on function calls.

Keep exploring

Updated 2026-10-14

Give every agent the right model.

Install AutoJev, add the providers you already pay for, and connect your agents in one click. Everything stays on your machine.

Free & open source · macOS · Windows · Linux