Skip to main content
This page points a coding harness at Model APIs. To let an agent operate your Baseten workspace and search these docs, see Connect your coding agent. For Cline, Roo Code, LangChain, and other tools, see Integrations. Point Pi, Droid, or OpenCode at Model APIs models such as zai-org/GLM-5.2 and moonshotai/Kimi-K3. Those harnesses call the OpenAI-compatible endpoint with BASETEN_API_KEY. You keep the harness and workflow you already have. Baseten Switch is a local gateway for Claude Code and Codex CLI. It routes those harnesses to Model APIs, charts spend against a native-provider estimate, and can send a request back to Anthropic or OpenAI. The same CLI installs Pi’s direct Baseten provider without starting the gateway. You can run Switch alongside a harness that calls Model APIs directly.

Agent harnesses

Call Model APIs from Pi, Droid, or OpenCode with BASETEN_API_KEY.

Baseten Switch

Connect Claude Code, Codex CLI, or Pi.

Switch CLI

Command reference for baseten-switch.

Agent harnesses

These harnesses call the OpenAI-compatible Model APIs endpoint with BASETEN_API_KEY. Create a personal API key, export it as BASETEN_API_KEY, then configure the harness. This is an inference key, not the management key used to connect your coding agent. Swap in any supported model.
Pi has a built-in Baseten provider. Configure it here when you already have BASETEN_API_KEY and want to pin the endpoint yourself. To load the visible Model APIs catalog into Pi, use Baseten Switch instead.After you set BASETEN_API_KEY, pick a path.
To run Pi on Model APIs:
To store the key in auth.json:
  1. Run /login in Pi.
  2. Select Baseten and store the key in ~/.pi/agent/auth.json.
Auth-file credentials take priority over the environment variable. The key field can be a literal or "$BASETEN_API_KEY". Pi’s agent directory defaults to ~/.pi/agent. Set PI_CODING_AGENT_DIR to override it.

Baseten Switch

Baseten Switch is in beta. Its interfaces, configuration, and behavior can change between releases.
Baseten Switch is a local gateway for Claude Code and Codex CLI. It maps model families to Model APIs slugs, charts Baseten spend against a native-provider estimate, and can send a request back to Anthropic or OpenAI. The same CLI installs Pi’s direct Baseten provider without starting the gateway. It requires macOS 13 or newer on Apple Silicon or Intel. For every command, see the Baseten Switch CLI. To install Baseten Switch:
  1. Trust Baseten’s Homebrew tap:
  2. Install the formula:
The fully qualified formula name adds the tap and installs both Baseten Switch and its Baseten CLI dependency. Switch authenticates with the current Baseten CLI profile, and both browser OAuth and API-key profiles work. To allow Baseten Switch on macOS: The beta build uses an ad hoc signature and isn’t notarized yet, so you might need to allow the app the first time you open it:
  1. Try to open Baseten Switch once, so macOS registers the block.
  2. Open System Settings > Privacy & Security and scroll to Security.
  3. Select Open Anyway next to Baseten Switch.
A managed Mac can prohibit this override.

Connect a coding harness

After baseten-switch up --install, use the menu bar app to toggle routing, map models, and view spend. Pi uses a direct provider that Switch installs, without starting the gateway. For every Switch command, see the Baseten Switch CLI.
To route Claude Code through Baseten:
  1. Initialize the configuration and sign in when prompted:
  2. Start the gateway and install the menu bar app:
  3. Point new Claude Code sessions at the gateway:
  4. Restart Claude Code.
  5. Verify the request path:

Next steps

Connect your coding agent

Install the Baseten skill and MCP servers so your agent can operate your Baseten workspace and search these docs.

Integrations

Call Model APIs from Cline, Roo Code, LangChain, and other tools.

Model APIs pricing

See rates for hosted models and compare spend.

Baseten Switch CLI

Commands for routing, models, spend, and health.

Baseten Switch README

Upgrade, uninstall, and configuration fields for Baseten Switch.