Repository navigation
OpenCode Go and Zen
OpenCode has two distinct read-only usage paths. They use different credentials and return different data. The Console opencode adapter, including Zen pay-as-you-go spend, is in 0.1.0. The Go API key adapter and the optional Zen balance for Go subscribers are in current source and need a later release for registry consumers. Use a path dependency or run the examples from the repository checkout for those additions.
| Path | Feature and provider | Credential | Data |
|---|---|---|---|
| Go API |
opencodego / ProviderId::OpenCodeGo
|
Go API key | Five-hour, weekly, and monthly utilization percentages and resets |
| Console |
opencode / ProviderId::OpenCode
|
Full Console session Cookie header |
Go subscription meters, or confirmed Zen pay-as-you-go 30-day spend and prepaid balance |
An OpenCode Go API key does not read the Zen wallet or discover workspaces. The Console adapter does not extract browser cookies or use the CLI's saved provider credentials.
From the repository checkout:
read -r -s -p "OpenCode Go API key: " OPENCODE_GO_API_KEY; echo
export OPENCODE_GO_API_KEY
cargo run --features opencodego --example real_usage -- go
unset OPENCODE_GO_API_KEYIn Rust:
use agentstat::{Client, Credentials, FetchRequest, ProviderId};
let key = std::env::var("OPENCODE_GO_API_KEY")?;
let request = FetchRequest::new(ProviderId::OpenCodeGo, Credentials::api_key(key));
let snapshot = Client::builder().build()?.fetch(request).await?;The quota percentages are provider-reported; they are not per-model token allowances or dollar balances.
Sign in to the OpenCode Console. In browser developer tools, open Network, select an authenticated Console request, and copy its complete Cookie request header. An API key or a single cookie value is not interchangeable with that header.
read -r -s -p "OpenCode Console cookie: " OPENCODE_COOKIE; echo
export OPENCODE_COOKIE
# Optional when you have multiple workspaces:
# export OPENCODE_WORKSPACE_ID=wrk_your_workspace
cargo run --features opencode --example real_usage -- opencode
unset OPENCODE_COOKIE OPENCODE_WORKSPACE_IDThe real_usage example selects a single workspace automatically, or uses OPENCODE_WORKSPACE_ID when set. A Zen pay-as-you-go workspace returns provider-reported spend for the last 30 days and a prepaid balance when available. A Go subscriber instead gets quota meters; include_optional(true) can also request its Zen prepaid balance. An optional balance failure becomes a warning without discarding the Go quotas.
Compare the real_usage results with the provider's own usage page. The normal test suite uses synthetic fixtures, so it does not establish that your account's session and endpoint still work. Report a sanitized match or mismatch through a provider check. A Zen pay-as-you-go account and a Go subscription exercise different Console response paths.
Repository · Rust API docs · Issues · Releases · Security