agentgate
agentgate guides/use-codex-with-openrouter

Codex + OpenRouter

Use Codex with OpenRouter through AgentGate.

AgentGate gives Codex one local endpoint and lets you choose OpenRouter, DeepSeek, OpenAI, or another upstream provider per route.

direct answer

Short answer: AgentGate gives Codex one local endpoint and lets you choose OpenRouter, DeepSeek, OpenAI, or another upstream provider per route.

Best fit

  • You want AI apps to keep one stable local endpoint.
  • You need provider switching, request logs, cost visibility, or failover.
  • You want client config changes to be reversible.

Not ideal

  • You use one client, one provider, and the setup rarely changes.
  • You do not need logs, failover, cost tracking, or config rollback.

Why not edit Codex every time

Provider experiments are easier when Codex points to one stable local gateway. AgentGate keeps that local endpoint stable while route profiles decide the upstream provider.

Setup path

Create or enable an OpenRouter provider, set the API key, choose a model, then apply the Codex config in AgentGate. Requests should appear in the logs with the selected upstream.

Routing flexibility

You can keep OpenRouter as the default route, add failover providers, or create separate profiles for different clients and tasks.

agentgate --faq

FAQ.

Can I use other OpenAI-compatible providers too?

Yes. AgentGate is designed to manage multiple upstream providers from a local gateway.

Do I need to change Codex again later?

Usually no. Keep Codex pointed at AgentGate and change routes inside AgentGate.