Skip to Content
OpenInfer Docs
Getting Started

Coding Agents

Run Claude Code and other coding agents on OpenInfer models.

OpenInfer serves the Anthropic Messages API at /v1/messages and the OpenAI Chat Completions and Responses APIs, so coding agents connect with a base URL and a key.

Use our Wrapper

Our wrapper binary, oi, launches your preferred harness with the proper environment, even pre-populating available models and context lengths based on what's available to you. Your own configuration is never modified, so you don't need to swap back and forth between configurations: your harness keeps working as it always did, and oi only changes the environment of the run it starts.

Installation

# Install `oi`
uv tool install openinfer-cli

Create a key at API Keys, then run a harness through oi. The first run asks for the key and saves the configuration.

Start any supported harness by putting oi in front of its command. Everything after -- is passed to the harness.

# Your normal configuration
claude

# On OpenInfer
oi claude

# Your normal configuration again
claude

Run Directly

You can also run oi without installing it, using uvx:

uvx openinfer-cli claude

Manual

If you'd rather configure a harness yourself, it needs three things: a base URL, your API key, and the models to use. Harnesses make many tool calls, so choose a model with reliable tool calling and a context window of 64k or more. Use slugs from GET /v1/models; @oi/GLM-5.3-Flash is used below.

Claude Code speaks the Anthropic Messages API. Set these variables in the shell that starts it:

export ANTHROPIC_BASE_URL=https://api.openinfer.ai
export ANTHROPIC_AUTH_TOKEN=pk_...
export ANTHROPIC_API_KEY=""
export ANTHROPIC_MODEL=@oi/GLM-5.3-Flash
export ANTHROPIC_DEFAULT_OPUS_MODEL=@oi/GLM-5.3-Flash
export ANTHROPIC_DEFAULT_SONNET_MODEL=@oi/GLM-5.3-Flash
export CLAUDE_CODE_SUBAGENT_MODEL=@oi/GLM-5.3-Flash
export ANTHROPIC_DEFAULT_HAIKU_MODEL=@oi/Qwen3.5-9B
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=131072
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=98304
claude

ANTHROPIC_BASE_URL is the host without /v1; Claude Code adds /v1/messages itself. ANTHROPIC_API_KEY must be empty, not unset. Claude Code doesn't know OpenInfer model IDs, so the two context variables declare the model's real window; set the compact window to about three quarters of it.

These files hold your API key, so keep them private (chmod 600). Set contextWindow and maxTokens to the model's real limits; the wrapper fills them in for you.

Other Agents

Any agent that lets you set an OpenAI-compatible base URL works the same way:

SettingValue
Base URLhttps://api.openinfer.ai/v1
API keyyour pk_… key
Modela text_gen model slug from GET /v1/models

Agents that use the Responses API, such as Codex, are served by /v1/responses. Agents that use Chat Completions are served by /v1/chat/completions.

On this page