Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.rigbox.dev/llms.txt

Use this file to discover all available pages before exploring further.

The managed AI proxy lets your workspace code call supported AI providers without putting provider API keys in the VM. Rigbox holds managed provider keys on your behalf, injects them at request time, and tracks usage against your credit balance.

How It Works

Every workspace can reach the proxy at http://172.16.0.1:9090 from inside the VM. When managed mode is active, AI SDK requests are routed through that bridge-local proxy, which fronts an OpenRouter gateway. The proxy:
  1. Intercepts the request from your workspace VM
  2. Resolves the workspace from the VM’s source IP on the compute bridge
  3. Injects Rigbox’s managed OpenRouter key (your VM never sees it)
  4. Forwards the request to OpenRouter, which routes to the appropriate upstream provider for the requested model
  5. Logs token usage and deducts from your credit balance
  6. Returns the response to your code
OpenRouter acts as a single gateway in front of every supported model family, so you only point your SDK at one endpoint regardless of which provider’s model you ask for. Pick the upstream provider by choosing the model slug (e.g. anthropic/claude-sonnet-4, openai/gpt-4o, google/gemini-2.5-pro).
Managed workspaces inject OPENROUTER_BASE_URL=http://172.16.0.1:9090/v1 and OPENROUTER_API_KEY at workspace boot, so SDKs and CLI tools that read OpenRouter env vars work out of the box. rig proxy on is still available inside the workspace shell to print equivalent export statements for use in scripts or CI.

Endpoints

The proxy speaks two HTTP shapes — OpenAI-compatible (used by most SDKs and tools) and an Anthropic-shaped passthrough for Claude Code. Both terminate on the same OpenRouter gateway behind the scenes.
EndpointShapeNotes
http://172.16.0.1:9090/v1/chat/completionsOpenAIDefault route for everything OpenAI-compatible. Pick the upstream model with the model field (anthropic/..., openai/..., google/..., etc.).
http://172.16.0.1:9090/v1/embeddingsOpenAIEmbedding models.
http://172.16.0.1:9090/v1/modelsOpenAIList models available to your account.
http://172.16.0.1:9090/v1/messagesAnthropicNative Anthropic Messages-API passthrough used by Claude Code. Streams via byte forwarding; credit metering for streaming responses on this endpoint is currently deferred.
http://172.16.0.1:9090/braveBrave SearchWeb Search API when configured for your environment.
A small set of free-tier models is also exposed through a free alias when Rigbox has the matching managed key. They consume credits at zero rate but otherwise behave identically.

Credit Tiers

Every Rigbox account comes with AI credits that reset monthly.
TierCredits / MonthBest For
Free250Trying out the platform, small experiments
Pro2,000Active development, prototyping, demos
Credits map roughly to API cost - one credit equals approximately $0.01 of upstream provider spend. The exact mapping depends on the model and token count.

Activate Managed Mode

Via the API

Set the AI configuration for a workspace to managed mode with your chosen provider and model.
curl -X PUT https://api.rigbox.dev/api/v1/workspaces/{workspace_id}/ai-config \
  -H "Authorization: Bearer $RIGBOX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "managed",
    "provider": "google",
    "model": "google/gemini-2.5-pro"
  }'

Via the CLI (Inside a Workspace VM)

Managed workspaces already inject OPENROUTER_BASE_URL and OPENROUTER_API_KEY into every login shell, so most tools work without any setup step. The rig proxy on helper is a convenience for scripts or CI where you want the exports printed explicitly:
eval "$(rig proxy on)"
This command:
  • Prints shell export statements for OPENROUTER_BASE_URL and OPENROUTER_API_KEY (plus a small set of compatibility variables for SDKs that prefer provider-native names)
  • Uses managed-by-rigbox placeholder API keys where SDKs require a non-empty key and don’t read OPENROUTER_API_KEY
  • Routes subsequent AI SDK calls in that shell through the Rigbox proxy
Use rig proxy status to see the configured endpoints, current shell state, and credit balance.
To deactivate:
eval "$(rig proxy off)"

Check Your Credit Balance

The fastest path is the CLI:
rig status
rig status prints your remaining credits, monthly total, current mode, and active workspaces. For programmatic access, see the Credits API reference.

View Usage Breakdown

Get a daily breakdown of credit consumption across your workspaces.
curl -s https://api.rigbox.dev/api/v1/users/me/ai-usage \
  -H "Authorization: Bearer $RIGBOX_TOKEN" | jq .
See the AI Usage API reference for full response schema and query parameters.

What Happens When Credits Run Out

When your credit balance reaches zero:
  1. API requests return HTTP 402 - the proxy rejects new managed AI calls until credits are available
  2. The UI shows an upgrade prompt - you can upgrade to Pro or switch to BYOK mode
  3. Existing services keep running - only new AI API calls are blocked; your workspace and non-AI services are unaffected
If you have a long-running agent or automated pipeline, it will start receiving 402 errors once credits are exhausted. Consider monitoring your balance programmatically using the credits endpoint.

End-to-End Example

Here is a complete flow: activate managed mode, make an AI call from inside the workspace, then check remaining credits. Step 1 - Activate managed mode for a workspace:
curl -X PUT https://api.rigbox.dev/api/v1/workspaces/ws_abc123/ai-config \
  -H "Authorization: Bearer $RIGBOX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode": "managed", "provider": "google", "model": "gemini-2.5-flash-lite"}'
Step 2 - Inside the workspace VM, configure the shell and make a call:
# (Optional — managed workspaces export these at login already.)
eval "$(rig proxy on)"

curl -sS "$OPENROUTER_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-flash-lite",
    "messages": [
      {"role": "user", "content": "Explain microVMs in one paragraph."}
    ]
  }' | jq .
Step 3 - Check remaining credits:
curl -s https://api.rigbox.dev/api/v1/users/me/credits \
  -H "Authorization: Bearer $RIGBOX_TOKEN" | jq .
# {"remaining": 1795, "total": 2000, "mode": "managed"}
Credit deduction happens synchronously - the balance is updated before the proxy returns the response to your code, so the credits endpoint always reflects the latest usage.

Switching Providers and Models

Because the managed gateway is OpenRouter, you can switch the upstream provider and model at any time by changing the model field on your request — there’s no environment change, no proxy restart, and no separate “configure provider” step:
# Same endpoint, different upstream model
curl -sS "$OPENROUTER_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-4o", "messages": [{"role": "user", "content": "hi"}]}'
The workspace-level ai-config (set via the API or UI) defines the default provider and model used by tools that don’t ask for one explicitly, and is also surfaced by rig proxy status.

Next Steps