How key routing works
When your agent processes a request, OCCode follows a priority chain to decide which model and API key to use:Routing table
| Scenario | Key used | Billed to |
|---|---|---|
| No custom keys configured | OCC Legacy key | Your OCCode credits |
| Anthropic key added, Claude set as default | Your Anthropic key | Your Anthropic account |
| OpenAI key added for image generation | Your OpenAI key (for images) | Your OpenAI account |
| Custom key fails or is invalid | Falls back to OCC Legacy | Your OCCode credits |
| Specific agent set to use Gemini | Your Google key | Your Google account |
Key types
Inference keys
Used for text generation — conversations, tasks, reasoning. This is your main AI model key (Anthropic, OpenAI, Google, etc.).
Image generation keys
Used for generating images. Typically an OpenAI (DALL-E) or other image model key.
Fallback behavior
OCCode is designed to never leave you stuck:- If your primary model is unavailable → tries your fallback model
- If your fallback model fails → uses OCC Legacy
- If credits are depleted → prompts you to top up or add a BYOK key
You can configure fallback chains in the Models app — set a primary model and one or more fallbacks.
Checking which key is active
In the Models app, each configured provider shows:- ✅ Active — currently being used
- ⏸️ Fallback — will be used if the primary fails
- ❌ Invalid — key needs to be updated

