anomalyco / anomalyco/opencode

Sessions using an openrouter or groq model never dispatch (UnsupportedApiError)

Open
#45,426 1 comment 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 27, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

What happened

With a valid OpenRouter or Groq key connected, the catalog lists their models (356 and 15 for me), the provider reads as connected, and then no session using one of those models ever produces an assistant message. The session is created, the prompt is admitted, and the drain fails:

level=ERROR message="Failed to drain Session" cause="SessionRunnerModel.UnsupportedApiError: Unsupported API for openrouter/minimax/minimax-m2.7:free: aisdk:@openrouter/ai-sdk-provider
    at fromCatalogModel (packages/core/src/session/runner/model.ts:164:9)

Same for groq with aisdk:@ai-sdk/groq.

Nothing surfaces to the client beyond an empty session, so it reads as a provider auth problem rather than a routing one. (That half of it is #34839.)

Why

SessionRunnerModel.fromCatalogModel routes exactly three AI SDK packages: @ai-sdk/openai, @ai-sdk/anthropic, and @ai-sdk/openai-compatible with a URL. Every openrouter catalog entry carries @openrouter/ai-sdk-provider and every groq entry carries @ai-sdk/groq, so both fall through to UnsupportedApiError. Groq's entries additionally carry no api.url at all.

Both APIs are OpenAI-compatible, and packages/llm/src/providers/openai-compatible-profile.ts already records that, with base URLs, for openrouter and groq (plus cerebras, deepseek, fireworks, togetherai, xai, baseten, deepinfra). The runner never consults that table.

Steps to reproduce
  1. Connect an OpenRouter (or Groq) API key.
  2. Start a session with any model from that provider, e.g. openrouter/minimax/minimax-m3:free.
  3. Send any prompt.
  4. No assistant message is produced; the server log shows the UnsupportedApiError above.
Workaround

Repackage the provider in the global config, which makes the existing compatible route pick it up:

"provider": {
  "openrouter": { "npm": "@ai-sdk/openai-compatible", "api": "https://openrouter.ai/api/v1" },
  "groq":       { "npm": "@ai-sdk/openai-compatible", "api": "https://api.groq.com/openai/v1" }
}

After a restart all 356 openrouter and 15 groq models dispatch normally, which is what suggests the profile table is the right fallback rather than a per-user config fix.

Version

packages/opencode 1.18.17, reproduced again on dev at c2eacd7.

PR: #45424

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.