Docs / Connect

Connect → Codex & Claude Code

Use AxForge with Codex CLI & Claude Code

OpenAI's Codex CLI speaks the Responses API and Anthropic's Claude Code speaks the Messages API — not Chat Completions. So AxForge serves both natively: api.axforge.ai/v1/responses and api.axforge.ai/v1/messages translate to the same models behind your key, with tool calling and streaming. Point each tool straight at us — no proxy.

Get the CLIs

Both are terminal tools installed from npm, and each is maintained by its own vendor — take the current command from their own pages (Codex CLI, Claude Code) rather than from us, so it does not go stale here. What matters for AxForge is the endpoint each one talks to, below.

Codex CLI

In your user-level ~/.codex/config.toml, add an AxForge provider that uses the Responses wire API:

model = "chat"                    # or agentic, or qwen3.8-27b-nvfp4
model_provider = "axforge"

[model_providers.axforge]
name = "AxForge"
base_url = "https://api.axforge.ai/v1"
env_key = "AXFORGE_API_KEY"       # env var holding your AxForge key
wire_api = "responses"

Export the key (export AXFORGE_API_KEY=your-axforge-key) and run codex.

Two things. wire_api must be "responses" — Codex removed the chat wire API in early 2026. Use a new model_provider id (don't override the built-in openai one), in the user-level file, not a project-local one.

Claude Code

Point Claude Code at AxForge's Anthropic-format endpoint with two env vars:

$ export ANTHROPIC_BASE_URL=https://api.axforge.ai
$ export ANTHROPIC_AUTH_TOKEN=your-axforge-key
$ claude                                  # runs on AxForge's /v1/messages

Always set the token. ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer; without a credential Claude Code falls back to a saved claude.ai login instead of AxForge. (ANTHROPIC_API_KEY, sent as x-api-key, works too.)

Prefer a gateway?

You don't need one, but if you already run LiteLLM for budgets, fan-out, or multiple providers, it can front AxForge and expose the same Responses and Messages surfaces — point Codex/Claude Code at the proxy instead. Either way works.

Check that it worked

Two things, and the second is the one that proves it end to end:

  1. The CLI starts without a provider error and answers a prompt.
  2. The reply streams rather than arriving in one piece.
  3. The call appears in the console at Billing & usage within a minute or two. Nothing else confirms that your key reached our API — a reply alone could be a cache or another provider.

When it does not work

What you seeWhat it meansFix
404 on /chat/completionsthe tool is speaking the wrong API for its endpointCodex wants /v1/responses, Claude Code wants /v1/messages — not /v1/chat/completions
401the key, or it is in the wrong variableeach CLI reads its own environment variable — check which one
It reaches the vendor insteadthe base URL was not picked upsome CLIs only read it at start — restart after changing it

Run the self-test first when you are unsure — it says in one click whether the problem is your key, your quota or us, so you know whether the tool is worth debugging at all.

Anything unclear on this page?

Ask on the forum — the answer helps the next person too.

Ask about this page
© 2026 AxForge · EU-hosted AI infrastructure Docs Models For AI axforge.ai Pricing Trust Acceptable use Community guidelines