Skip to main content
Rigbox workspaces come with a full Linux environment, SSH access, and a managed AI proxy — making them a natural home for AI coding agents. Tools like Claude Code, Codex CLI, OpenCode, Kilo Code, Junie, and Pi can use Rigbox credits without ever seeing a provider API key.

Before you begin

Use the v0.13 CLI and authenticate. Run workspace-management and recipe commands from your local terminal. Commands identified as running inside a workspace require its console terminal or SSH session. Replace example resource IDs with the values returned for your account. Start the target workspace first and verify its identity with rig workspace ls. AI calls require managed credits or an appropriately configured provider account.

How It Works

Managed workspaces expose OPENROUTER_BASE_URL and OPENROUTER_API_KEY to every login shell. The bridge-local proxy at 172.16.0.1:9090 fronts OpenRouter, which in turn routes to the appropriate upstream provider for whatever model you ask for. Your credits cover the usage; provider API keys stay outside the VM. The built-in coding agents — claude, codex, opencode, kilocode, junie, and pi — each come with a small /etc/profile.d/ script that hands those settings to the agent in the form it expects: Anthropic variables for Claude Code, OpenAI variables for Codex, the Kilo and Junie provider variables for Kilo Code and Junie, while OpenCode and Pi read the OpenRouter variables directly. Install the agent and start it; there is nothing else to configure. Claude Code’s script steps aside when you use your own Claude login or key.

Supported Tools

Quick Setup

Add an agent to a workspace that already exists by its catalog ID:
The command starts the install and returns; the agent is ready when the install finishes. It prints the app it created; to follow the install, run rig app logs --app <APP_NAME> --install. The full ref @rigbox/claude@builtin works too. Inside the workspace itself, pass the workspace’s own name to --workspace. To create a workspace with agents already installed, name them when you create it:
Each agent installs its executable on $PATH and its routing script in /etc/profile.d/. There is no service to start: SSH into the workspace and run the agent. See Catalog Apps → CLI-shape recipes for the routing details and equivalent API call.

Manual install (for tools without a catalog recipe)

For Gemini CLI and Aider, install the package yourself:
Managed workspaces export OPENROUTER_BASE_URL and OPENROUTER_API_KEY at login, so most OpenRouter-aware tools just work. For OpenAI-compatible tools that read OPENAI_BASE_URL and OPENAI_API_KEY instead, run eval "$(rig proxy on)" to set them for your current shell. Anthropic clients take the proxy root, http://172.16.0.1:9090, as their base URL; see base URLs.

Start coding

Use the dev or full image for AI coding tools. They include build toolchains that coding agents often need (compilers, linters, test runners).

Tool-Specific Setup

Claude Code

rig recipe app install --ref claude installs Claude Code and a routing script, /etc/profile.d/claude-routing.sh. In a new login shell, the script points Claude Code at the workspace’s OpenRouter settings: ANTHROPIC_BASE_URL becomes the proxy root, http://172.16.0.1:9090 in managed mode (Claude Code adds /v1/messages itself), and ANTHROPIC_AUTH_TOKEN the workspace’s key, which in managed mode is a placeholder the proxy replaces. After SSH-ing in, just run:
The script routes Claude Code only while you have no Claude authentication of your own. Any of these takes precedence, starting with the next login shell:
  • signing in from Claude Code (/login), which saves ~/.claude/.credentials.json (or the same file under CLAUDE_CONFIG_DIR);
  • an API key or apiKeyHelper saved in Claude Code’s configuration;
  • ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, CLAUDE_CODE_OAUTH_TOKEN, or ANTHROPIC_BASE_URL already set in the environment, for example with rig workspace env set.
A shell that was already routed keeps its settings, so open a new one after signing in. To keep Claude Code off the workspace route for good, create the opt-out file:
Installing the item leaves your Claude setup alone. It adds hasCompletedOnboarding to ~/.claude.json only when that key is missing, so an existing login and project history stay as they are, and it doesn’t write ~/.claude/settings.json, so permission prompts stay at Claude Code’s defaults. Claude Code can edit files, run shell commands, manage git, and run tests inside the workspace. The VM provides an isolation boundary, but the agent can access files and credentials available inside that workspace and can act on external services those credentials authorize. See security boundaries.
Claude Code uses Claude Sonnet by default. To use Opus, pass --model claude-opus-4-20250514. Credit consumption is higher for Opus.

Codex CLI

rig recipe app install --ref codex configures the agent to send OpenAI-shape requests to OpenRouter, picking up OPENAI_BASE_URL / OPENAI_API_KEY from the routing shim:

OpenCode

OpenCode reads OPENROUTER_API_KEY natively, so the catalog install only needs to drop the binary in place:

Kilo Code

rig recipe app install --ref kilocode writes a shim that maps OPENROUTER_* to the KILO_* environment variables the agent expects:

Junie

rig recipe app install --ref junie installs JetBrains’ Junie CLI and a shim that copies OPENROUTER_API_KEY to JUNIE_OPENROUTER_API_KEY, which Junie reads first. Its install downloads a larger bundle, so it takes longer than the others.

Pi

rig recipe app install --ref pi installs Pi, which reads OPENROUTER_API_KEY directly:

Gemini CLI

Gemini CLI doesn’t have a catalog recipe yet — install with npm install -g @google/gemini-cli. Configure the authentication and provider endpoint supported by your installed Gemini CLI. Native Google requests are not automatically translated by the OpenAI-compatible gateway. With your own Google credentials configured, start the agent:

Aider

Aider supports multiple providers. The following examples use provider-native model identifiers and require that provider’s credentials and endpoint configuration. Choose a model available to your provider account; do not assume a native Google request is translated by the managed OpenAI-compatible gateway:

Automate with Setup Scripts

To give new workspaces a coding agent from the start, name it with --catalog when you create them, as in Quick Setup. For tools without a catalog recipe, attach a setup script that installs the package:

Monitor Credit Usage

AI coding tools can consume credits quickly — especially agentic tools that make many API calls in a loop. Monitor your balance:
For programmatic access (e.g. polling from a CI job), see Get Credits.
Agentic tools like Claude Code and Codex can make dozens of API calls per task. A single complex refactoring session might use 50-200 credits depending on the model and codebase size. Monitor your balance if you’re on the free tier.

BYOK Alternative

If you burn through managed credits quickly, switch to BYOK mode and use your own API keys for unlimited usage. Flip the workspace mode, then set your provider key as a workspace environment variable:
Restart the tool in a fresh shell and configure its provider key and endpoint. Verify that no managed base-URL override remains in the tool configuration. With ANTHROPIC_API_KEY set, Claude Code’s routing script leaves Claude Code on your own key.

Why Rigbox for AI Coding

Verify and troubleshoot

Inside the workspace, inspect rig proxy status, then make one small request with your chosen tool. Verify the configured endpoint and check the corresponding Rigbox or provider usage. After changing keys or mode, start a fresh shell and restart processes that retained their old configuration. Never print a provider key to verify it. If Claude Code uses the workspace route when you expected your own login, or the other way round, check the list above and open a new login shell. In a shell where the script routed Claude Code, echo $RIGBOX_CLAUDE_ROUTED prints 1. For failures, start with runtime logs, health checks, or resource exhaustion.

Next Steps