Repository navigation
Description
Summary
On v1.18.21 (Windows x64), every provider that authenticates via a stored "type": "api" credential in auth.json fails to run a prompt, throwing SessionRunnerModel.ModelUnavailableError: Model unavailable: <provider>/<model> — even though the credential itself is valid (confirmed by calling each provider's real API directly with the same key, which succeeds).
Providers that do not depend on auth.json (native free models, e.g. opencode/big-pickle, and providers that need no key, e.g. huggingface's public inference) work correctly and return real completions.
Reproduction
- Store a valid API key for any provider via the normal auth flow (results in
auth.jsoncontaining{"type":"api","key":"..."}). POST /api/sessionwith{"model":{"providerID":"<provider>","id":"<model>"}}— session is created successfully,GET /api/session/:idshows the correct model.POST /api/session/:id/promptwith a simple text prompt — request is accepted (200, admitted into the queue).- Poll
GET /api/session/:id/message— no assistant message ever appears. Server log shows:level=ERROR message="Failed to drain Session" cause="SessionRunnerModel.ModelUnavailableError: Model unavailable: <provider>/<model>"
Providers tested (all fail identically)
Groq, OpenRouter, Mistral, Cerebras, Chutes, Novita AI, NVIDIA, Google, Z.ai (zhipuai), Cloudflare Workers AI — 10/10 tested, each with a real key confirmed working against the provider's own API directly (e.g. curl https://api.groq.com/openai/v1/chat/completions with the same key succeeds; the OpenCode session for the same provider/model never completes).
Providers that work
opencode/big-pickle(built-in free model, noauth.jsonentry)huggingface/<any model>(noauth.jsonentry — public inference)
Environment
- OpenCode v1.18.21, Windows x64, downloaded from the official GitHub release asset (
opencode-windows-x64.zip) - Server started via
opencode serve --port <n> --hostname 127.0.0.1 - Confirmed on a freshly-recreated
opencode serveprocess (ruled out stale-process/cache as the cause) auth.jsoncredential shape:{"type":"api","key":"<valid key>"}(standard shape, same as used byopencode auth login)
What we ruled out
- Not a stale-process issue: restarted the server fresh, bug persists.
- Not an invalid-key issue: every key tested authenticates successfully against the provider's own API directly.
- Not a model-ID issue: tried multiple model IDs per provider, including ones taken directly from
/provider's own catalog listing for that provider. - Not a network/connectivity issue: the machine has normal internet access (confirmed against unrelated hosts), and providers that don't need
auth.jsonwork fine from the same process.
This suggests SessionRunnerModel.resolve() is failing to resolve/apply "type":"api" credentials from auth.json for third-party providers, even though the same auth.json is correctly used to populate /provider's connected list (which does show these providers as connected).
Happy to provide more logs/repro details if useful.
Activity
github-actions commentedon Sep 6, 2026
This issue might be a duplicate of existing issues. Please check:
auth.jsoncredentials not loaded automatically in new sessions — same symptom of stored"type":"api"keys not being applied when calling providers, resulting in auth/unavailability failures/connectare not applied to a running server (SAP AI Core, GitHub Copilot), and SAP multi-line keys are stored truncated #46354: Credentials set via CLI//connectare not applied to a running server — overlapping root cause around credential state not being resolved correctly at request timeserve: GET /api/modelomitsauth.jsonproviders — also inopencode servemode, auth.json-backed providers are not surfaced through the API surfacethdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊