Omni.Providers.OpenCode (Omni v1.3.0)

Copy Markdown View Source

Provider for the OpenCode Zen API.

Zen is a multi-model gateway that routes to different upstream APIs (Anthropic, OpenAI, Google, and others) through a single service. Unlike single-dialect providers, the wire format depends on the model — Claude models use the Anthropic Messages format, GPT models use OpenAI Responses, and so on. The correct dialect is resolved per-model from the data files.

Not loaded by default — must be explicitly enabled. Either add it to your provider list in application config:

config :omni, :providers, [:anthropic, :openai, :google, :opencode]

Or load it at runtime:

Omni.Provider.load([:opencode])

Reads the API key from the OPENCODE_API_KEY environment variable — no further configuration is needed if the variable is set.

Configuration

Override the default API key or base URL via application config:

config :omni, Omni.Providers.OpenCode,
  api_key: {:system, "MY_OPENCODE_KEY"}

Any key from the provider's config/0 can be overridden: :api_key, :base_url. See Omni.Provider for details.