Skip to main content

Module preset

Module preset 

Source
Expand description

Backend preset table: one entry per upstream provider/gateway.

Each preset maps the API-key env vars documented by pi and the provider catalog used by opencode (via models.dev) to an OpenAI-compatible (or Anthropic-native) base URL plus a small default model list. Presets activate when one of their key env vars is set; everything else has a default so export FOO_API_KEY=... is enough.

Per-backend overrides (all optional):

  • <PREFIX>_BASE_URL — override the endpoint (also honors the well-known vars listed in base_envs, e.g. OPENAI_BASE_URL).
  • <PREFIX>_MODELS — comma-separated model ids to advertise instead of the built-ins.
  • <PREFIX>_MODEL — single model id (same effect, one entry).

A fully custom OpenAI-compatible endpoint works without a preset:

  • INFINITY_OPENAI_BASE_URL + INFINITY_OPENAI_API_KEY (+ optional INFINITY_OPENAI_MODELS).

Structs§

BackendModel
One model offered by a resolved backend.
Preset
One upstream provider/gateway.
PresetModel
A built-in model advertised for a backend.
ResolvedBackend
A backend resolved from the environment and ready to serve.

Enums§

Flavor
Wire flavor of a backend.

Constants§

PRESETS

Functions§

resolve_backends
Scan the environment for every configured backend, in preset order.