Skip to content

Support OPENCODE_API_KEY passthrough and model selection for OpenCode agent #194

@NathanFlurry

Description

@NathanFlurry

Context

When running OpenCode CLI locally (without Sandbox Agent), it can use the OPENCODE_API_KEY env var set to a Zen API key. Running opencode auth list shows provider "zen" through the env var. Selecting a model like gemini-3-pro works (though may require billing).

Requests

1. Pass OPENCODE_API_KEY to the OpenCode agent

Sandbox Agent already passes CODEX_API_KEY for the codex agent. It should similarly pass OPENCODE_API_KEY to the OpenCode agent process.

An alternative approach is writing ~/.local/share/opencode/auth.json:

{
  "opencode": {
    "type": "api",
    "key": "sk-..."
  }
}

2. Support model selection per agent in sessions

There's currently no way to specify which model an agent should use when creating a session via the SDK. This blocks testing providers like Zen that require a specific model to be selected.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions