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 withBASETEN_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
- Droid
- OpenCode
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.- Built-in provider
- Config file
To run Pi on Model APIs:To store the key in auth.json:
- Run
/loginin Pi. - Select Baseten and store the key in
~/.pi/agent/auth.json.
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.
-
Trust Baseten’s Homebrew tap:
-
Install the formula:
- Try to open Baseten Switch once, so macOS registers the block.
- Open System Settings > Privacy & Security and scroll to Security.
- Select Open Anyway next to Baseten Switch.
Connect a coding harness
Afterbaseten-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.
- Claude Code
- Codex CLI
- Pi
To route Claude Code through Baseten:
-
Initialize the configuration and sign in when prompted:
-
Start the gateway and install the menu bar app:
-
Point new Claude Code sessions at the gateway:
- Restart Claude Code.
-
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.