Skip to main content

key

Function key 

Source
pub fn key() -> Option<String>
Expand description

The Go key: OCUSE_API_KEY, else OPENCODE_API_KEY, else the opencode-go entry of opencode’s own auth file — the same credential /connect stores. The bearer token, in opencode’s own order of precedence.

The store leads the legacy file because v2 writes provider credentials to credential and /connect is what actually replaces a key; auth.json is only where a v1 install keeps them. Reading the file first (or alone) is how the dashboard came to say api_key_expired while Go inference was working: the replacement key had gone to the store, and the file still held the old one.