Skip to main content

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

ScenarioKey usedBilled to
No custom keys configuredOCC Legacy keyYour OCCode credits
Anthropic key added, Claude set as defaultYour Anthropic keyYour Anthropic account
OpenAI key added for image generationYour OpenAI key (for images)Your OpenAI account
Custom key fails or is invalidFalls back to OCC LegacyYour OCCode credits
Specific agent set to use GeminiYour Google keyYour 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:
  1. If your primary model is unavailable → tries your fallback model
  2. If your fallback model fails → uses OCC Legacy
  3. 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