Skip to main content
Beige uses the pi SDK (@mariozechner/pi-coding-agent) for all LLM interaction. You configure which providers and models are available, then assign them to agents.

Configuring Providers

Providers are registered under llm.providers in config.json5. Each key becomes a provider name that agents reference.

Provider Fields

*Local providers like Ollama don’t need an apiKey.

API Types

Built-in providers (anthropic, openai, google) have their API type set automatically. For all other providers, set api explicitly.

Assigning a Model to an Agent

Each agent specifies its model under model:

Thinking Levels

Thinking levels control how much internal reasoning a model does before responding. Only models that support extended thinking (e.g. Claude 3.7+) use this setting — other models ignore it.

Model Fallbacks

When the primary model fails (rate limit, provider error), the gateway tries fallback models in order:

Model Restriction

The model and fallbackModels fields define the only models an agent can use. Users cannot switch to other models via the TUI or API — even if other providers are configured. This ensures:
  • Predictable behavior — agents always use known, tested models
  • Cost control — no accidental usage of expensive models
  • Compliance — enforce model policies per agent

Rate Limit Handling

When a provider returns HTTP 429 or a rate-limit error:
  1. The provider/model is marked as “cooling down”
  2. If a retry-after header is present, that duration is used
  3. Otherwise, a 30-minute default cooldown is applied
  4. Cooldown state is persisted to ~/.beige/data/provider-health.json and survives gateway restarts

When to Use Fallbacks

  • High availability — Keep agents working even if one model is rate-limited
  • Cost control — Use a cheaper model as fallback for non-critical work
  • Model migration — Gradually shift from one model to another

Concurrency Limits

When running many agents or handling high-traffic channels, parallel LLM requests to a single provider can spike. The concurrency setting prevents this by capping in-flight requests per provider:
  • Requests beyond the limit wait in a FIFO queue until a slot frees up — they are never rejected or errored.
  • Omit concurrency (or set to -1) for unlimited parallel requests (the default).
  • The limit applies per provider across all agents and sessions — all models on the same provider share the pool.
  • This is complementary to rate-limit handling: concurrency limits prevent overloading a provider, while fallback models handle errors after they occur.