400 Bad Request for every openrouter prompt for 0.2.22 #607

Closed
opened 2026-02-16 17:27:34 -05:00 by yindo · 7 comments
Owner

Originally created by @eaSyMaxSU on GitHub (Jul 10, 2025).

Originally assigned to: @thdxr on GitHub.

The following error appears for openrouter promts.

ERROR 2025-07-10T15:54:07 +0ms service=tui failed to send message: POST "http://127.0.0.1:56639/session/ses_80af4d182ffe4EJ3Nw2XR5s0yS/message": 400 Bad Request {"name":"ProviderInitError","data":{"providerID":"openrouter"}}
Image

And the opencode auth.
Image

Originally created by @eaSyMaxSU on GitHub (Jul 10, 2025). Originally assigned to: @thdxr on GitHub. The following error appears for openrouter promts. ERROR 2025-07-10T15:54:07 +0ms service=tui failed to send message: POST "http://127.0.0.1:56639/session/ses_80af4d182ffe4EJ3Nw2XR5s0yS/message": 400 Bad Request {"name":"ProviderInitError","data":{"providerID":"openrouter"}} <img width="2259" height="417" alt="Image" src="https://github.com/user-attachments/assets/2c11b203-fce4-4532-b862-49e90c818217" /> And the opencode auth. <img width="508" height="249" alt="Image" src="https://github.com/user-attachments/assets/50cd49e7-22c1-4d71-8d0d-29fb6e877263" />
yindo closed this issue 2026-02-16 17:27:34 -05:00
Author
Owner

@Pranav-Official commented on GitHub (Jul 10, 2025):

same issue here... any idea anyone?

@Pranav-Official commented on GitHub (Jul 10, 2025): same issue here... any idea anyone?
Author
Owner

@DenzelVH commented on GitHub (Jul 10, 2025):

Same issue
Image

The issue is gone when I disable my config.json file + removing ~/.cache/opencode folder

Image

My config.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openrouter": {
      "npm": "@openrouter/ai-sdk-provider",
      "name": "OpenRouter",
      "options": {},
      "models": {
        "mistralai/devstral-medium": {
          "name": "Mistral: Devstral Medium"
        },
        "mistralai/devstral-small": {
          "name": "Mistral: Devstral Small 1.1"
        },
        "inception/mercury": {
          "name": "Inception: Mercury"
        }
      }
    }
  }
}

@DenzelVH commented on GitHub (Jul 10, 2025): Same issue <img width="679" height="219" alt="Image" src="https://github.com/user-attachments/assets/6abe117b-363e-400c-92f9-56d564cf349c" /> The issue is gone when I disable my `config.json` file + removing `~/.cache/opencode` folder <img width="835" height="429" alt="Image" src="https://github.com/user-attachments/assets/9fcdf1dd-bd33-43eb-b92a-f3ef4347d9ed" /> My config.json ```json { "$schema": "https://opencode.ai/config.json", "provider": { "openrouter": { "npm": "@openrouter/ai-sdk-provider", "name": "OpenRouter", "options": {}, "models": { "mistralai/devstral-medium": { "name": "Mistral: Devstral Medium" }, "mistralai/devstral-small": { "name": "Mistral: Devstral Small 1.1" }, "inception/mercury": { "name": "Inception: Mercury" } } } } } ```
Author
Owner

@eaSyMaxSU commented on GitHub (Jul 10, 2025):

Still having this issue after removing config.json and clearing cache/opencode.

@eaSyMaxSU commented on GitHub (Jul 10, 2025): Still having this issue after removing config.json and clearing cache/opencode.
Author
Owner

@damianpdr commented on GitHub (Jul 10, 2025):

same issue on my side

@damianpdr commented on GitHub (Jul 10, 2025): same issue on my side
Author
Owner

@thdxr commented on GitHub (Jul 10, 2025):

@openrouter/ai-sdk-provider does not work with ai sdk v5 which we use. remove the npm field you don't need it. also we added devstral to models.dev so you can probably get rid of the whole config

@thdxr commented on GitHub (Jul 10, 2025): @openrouter/ai-sdk-provider does not work with ai sdk v5 which we use. remove the `npm` field you don't need it. also we added devstral to models.dev so you can probably get rid of the whole config
Author
Owner

@eaSyMaxSU commented on GitHub (Jul 10, 2025):

Removing the config do not solve the issue for me.

@eaSyMaxSU commented on GitHub (Jul 10, 2025): Removing the config do not solve the issue for me.
Author
Owner

@DenzelVH commented on GitHub (Jul 10, 2025):

@openrouter/ai-sdk-provider does not work with ai sdk v5 which we use. remove the npm field you don't need it. also we added devstral to models.dev so you can probably get rid of the whole config

Is it only available via the Mistral provider?

Image

Edit: nvm, I use this setup for Devstral Openrouter and it works

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "openrouter": {
      "name": "OpenRouter",
      "options": {},
      "models": {
        "mistralai/devstral-medium": {
          "name": "Devstral Medium",
          "attachment": false,
          "reasoning": false,
          "temperature": true,
          "tool_call": true,
          "release_date": "2025-07-10",
          "cost": { "input": 0.4, "output": 2 },
          "limit": { "context": 128000, "output": 128000 }
        },
        "mistralai/devstral-small": {
          "name": "Devstral Small",
          "attachment": false,
          "reasoning": false,
          "temperature": true,
          "tool_call": true,
          "release_date": "2025-05-07",
          "cost": { "input": 0.1, "output": 0.3 },
          "limit": { "context": 128000, "output": 128000 }
        }
      }
    }
  }
}
@DenzelVH commented on GitHub (Jul 10, 2025): > @openrouter/ai-sdk-provider does not work with ai sdk v5 which we use. remove the `npm` field you don't need it. also we added devstral to models.dev so you can probably get rid of the whole config Is it only available via the Mistral provider? <img width="586" height="177" alt="Image" src="https://github.com/user-attachments/assets/4fe61c06-6b41-4749-a935-8fe411f0a490" /> Edit: nvm, I use this setup for Devstral Openrouter and it works ```json { "$schema": "https://opencode.ai/config.json", "provider": { "openrouter": { "name": "OpenRouter", "options": {}, "models": { "mistralai/devstral-medium": { "name": "Devstral Medium", "attachment": false, "reasoning": false, "temperature": true, "tool_call": true, "release_date": "2025-07-10", "cost": { "input": 0.4, "output": 2 }, "limit": { "context": 128000, "output": 128000 } }, "mistralai/devstral-small": { "name": "Devstral Small", "attachment": false, "reasoning": false, "temperature": true, "tool_call": true, "release_date": "2025-05-07", "cost": { "input": 0.1, "output": 0.3 }, "limit": { "context": 128000, "output": 128000 } } } } } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#607