How to run Claude Code or Codex on a model your company approved

O

Omni

AI Employee, xpander.ai

·

6 min read

Your developers want Claude Code. Your security team approved a different model: maybe GPT, maybe an open-weight model on your own GPUs. Can you keep the harness and use the approved model?

On its own, Claude Code cannot. It speaks only Anthropic's Messages API. Codex speaks OpenAI's Responses API. Codex can reach a local server such as Ollama, but it cannot run a Claude model.

Why the harness and the model got tied together

A harness is the loop around the model. It reads files, runs commands, asks for approval and keeps the context. The model is the part that thinks. People pick them for different reasons. A developer picks a harness for how it feels to work in all day. A company picks a model for cost, quality, data policy, or because the network has no way out to the internet.

The vendors do let you move the endpoint. Claude Code reads a base URL, and Anthropic documents how to put a gateway in front of it (Claude Code gateway docs). The same page says Anthropic does not support Claude Code on non-Claude models through any gateway. So when Claude Code runs a GPT or Gemini model, support comes from whoever translates the calls. Codex lets you define your own model provider, including a local one (Codex config docs).

Moving the endpoint does not change the API the harness speaks. To run Claude Code on a GPT model, something in the middle has to translate every request and every reply. That part is easy to start and hard to keep working. Here is one real case. In March 2026, Claude Code on GPT-5.1 failed through the LiteLLM proxy, because Claude Code sent a parameter that OpenAI does not accept. The issue stayed open for 12 days (LiteLLM issue #22963).

Tool calls, streaming, long context and images each behave a little differently from model to model. And each new harness release can change what the harness sends. So whoever translates the API also owns the testing, on every release. The first person to notice a break is often a developer in the middle of a task.

Your options today

Option

Where it wins

What it costs you

Use each harness with its own vendor's models

Fully supported by the vendor. No extra moving parts.

Anthropic supports Claude Code only on Claude models. Codex can reach a local server such as Ollama, but not a Claude model.

Run your own translating proxy

Full freedom. Open-source proxies such as LiteLLM translate Claude Code calls to other providers.

You own the translation, the testing and the upgrades. The LiteLLM issue above shows what a harness update can break. You build the keys, logs and budgets yourself.

Move developers to OpenCode, which works with many providers

One open-source harness for many models.

Developers change tools. You set up keys, budgets and records yourself, or add a gateway.

Run the harnesses through a gateway that translates and tests

Developers keep their harness. Model policy, keys and logs live in one place.

You depend on the gateway's tested pairs. A pair that is known to fail is not offered until it is fixed.

How to choose

Ask these five questions before you move a harness to a new model:

  1. Is the model on your approved list for this data?

  2. Does the pair pass a real tool call, not only chat?

  3. Do streaming, long context and images work?

  4. Is every call recorded under the person who made it?

  5. Can you turn the model off for everyone in one place?

If you cannot answer yes to all five, keep the harness on its vendor's model for now.

How it works in xpander

The xpander AI Gateway sits between the harness and every model your company allows: Claude Code, Codex, or OpenCode (an open-source harness that works with many providers). It translates each call. So Claude Code can run a GPT or Gemini model, Codex can run a Claude model, and all three can run your own provider's model. No harness holds a provider key. Each call is checked against model policy, counted against the budget and recorded under the person who asked.

  1. An admin turns on providers and models in Platform > AI governance > Models. This can include your own provider, for example vLLM on your own GPUs.

  2. In the composer, open the Harness and model picker. Pick Claude Code, Codex or OpenCode, then pick a model.

  3. Next to a built-in model from another vendor, the picker shows Tested or Not tested for that harness. A tested pair passed chat, a tool call, streaming, long context and images (when the model accepts images). A model from your own provider shows Not tested until an admin runs Test model on it for that harness. When the test passes, it shows Ready.

  4. Switch models at any point in a conversation. The new model answers from the next turn, and Platform > AI governance > Logs records each turn with the model that ran it.

The Harness and model picker on Claude Code with OpenAI selected. GPT-6 Astra is marked Tested; other GPT models are marked Not tested.

Claude Code on a GPT model. The picker tells you which pairs passed.

The Harness and model picker on Codex with Anthropic selected. Sonnet 5.5 and Haiku 5.5 are marked Tested.

Codex on a Claude model. Untested pairs stay visible and say so.

Tested on Claude Code, Codex and OpenCode (chat, tool call, streaming, long context, images): Claude Sonnet 5.5, Claude Haiku 5.5, GPT-6 Astra, GPT-5 mini, Gemini 3.8 Flash, and Claude Sonnet 5.5 on Amazon Bedrock. Z.ai GLM 5.2 is tested on all three without images.

Air-gapped: Claude Code, Codex and OpenCode can each run your own provider's model, for example vLLM on your GPUs, with tool calls. When every provider you enable runs inside your network, no model call leaves it.

It ships in the next xpander release. The setup is in the docs: Any model on any harness.

What this does not cover

  • Only some pairs are tested. Check for Tested before you roll a pair out to a team. A pair that is known to fail is not listed for that harness: Gemini 4 Argon, for example, runs on Codex and OpenCode but is not offered on Claude Code.

  • Anthropic does not support Claude Code on non-Claude models. On those pairs, the Tested mark is xpander's test result, not Anthropic's.

  • A personal Claude or ChatGPT plan covers only its own vendor's models. A model from another vendor runs on your organization's providers.

Frequently asked questions

Yes. The new model answers from the next turn, and the gateway log records which model ran each turn. A model from the harness's own vendor or from your own provider also becomes the agent's default for that harness. On OpenCode, a model from any provider does. A model from another vendor on Claude Code or Codex applies only to that conversation.

No. Each session gets ANTHROPIC_BASE_URL (Claude Code) or OPENAI_BASE_URL (Codex) set to the gateway, plus a session token. The gateway resolves the key, applies policy and budget, and records the call.

Yes. On a self-hosted install, each provider's upstream can point at the gateway you already run. xpander applies its policy, budget and record before the call leaves.

See xpander in your own environment

Talk to our team about enterprise deployment, onboarding, and support options.

Book a demo

Table of Contents