Skip to main content
OpenCode is a terminal coding agent that supports custom providers. Bifrost CLI generates an isolated OpenCode provider for the selected gateway model.
OpenCode sends x-session-affinity and x-session-id on every request, so a session sticks to the provider and key that served it and keeps hitting the same prompt cache, with nothing to configure. See Session Affinity.
Bifrost creates a temporary OpenCode runtime configuration with:
  • a provider named bifrost;
  • the Bifrost /openai endpoint;
  • the selected provider-qualified model; and
  • the effective SSO agent token or virtual key.
OpenCode sees the selected model as bifrost/<provider>/<model>, for example bifrost/openai/gpt-5. The temporary configuration is removed when the process exits. Enterprise SSO and virtual keys are both supported.
OpenCode receives one agent access token when it starts. If a long-running session reaches token expiry, exit and relaunch it through Bifrost so the CLI can refresh the Enterprise session first.

Configure OpenCode manually with a virtual key

Create or update ~/.config/opencode/opencode.json:
Use the provider/model pair as OpenCode’s model reference:
When configuring multiple teams or environments, use a separate Bifrost virtual key for each required governance boundary.

Model selection

Bifrost’s generated OpenCode provider contains the model selected when the harness starts. Relaunch from the Bifrost chooser or command line to use a model that is not in that generated provider:
The target must support the tool calls and streaming behavior OpenCode uses for file access, terminal commands, and editing.

Theme and terminal appearance

The OpenCode conversation, prompt boxes, activity lines, and model footer are rendered by OpenCode. Harnesses selected through bifrost launch receive native terminal passthrough, matching the rendering used by bifrost opencode. The optional bifrost launch --tabs mode uses Bifrost’s virtual terminal and may render modern terminal features differently. Bifrost currently checks ~/.config/opencode/tui.json. If that file has no explicit theme, Bifrost supplies a temporary OpenCode TUI configuration with:
OpenCode’s system theme uses the terminal ANSI palette and background. It can therefore have low contrast on some terminal palettes even though Bifrost does not reinterpret the harness output. To keep the normal OpenCode appearance, create ~/.config/opencode/tui.json:
You can replace opencode with another built-in or custom OpenCode theme. Use tui.json for the launcher-detected global setting; TUI options are separate from the provider settings in opencode.json.

Troubleshooting

OpenCode reports a Google API key is missing

Check the model/provider shown in OpenCode’s footer. A Bifrost-launched model should use the generated bifrost/... provider. If OpenCode is using its native Google provider instead, relaunch with:
This is separate from Gemini CLI’s authentication behavior.

OpenCode colors look different

Set an explicit theme in ~/.config/opencode/tui.json and restart Bifrost CLI.

401 Unauthorized during a long session

Exit and relaunch OpenCode through Bifrost. The preflight refreshes the SSO session before starting the new child process.

Observability

OpenCode traffic through Bifrost is logged and attributed to the selected provider, model, user or virtual key, and application. Use the Bifrost logs view or bifrost logs list to inspect it.

Next steps