Starting from v1.0.86, legcay API provider stops working #3048

Closed
opened 2026-02-16 17:38:22 -05:00 by yindo · 5 comments
Owner

Originally created by @moritzschaefer on GitHub (Nov 21, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Starting from version v1.0.86 (v1.0.85 is still fine), I get the following error:

  ┃  litellm.BadRequestError: AzureException BadRequestError - Unknown parameter: 'usage'.. ' Received Model Group=gpt-5
Available Model Group Fallbacks=None

The caveat: I use an API wrapper from my organization (Stanford), which lags behind the API features of public providers. I configured opencode to use OpenRouter, which started breaking upon v1.0.86.

Is there a way to explicitly use the legacy OpenAI API?

Here is my opencode config:

    "provider": {
        "openrouter": {
            "options": {
                "baseURL": "https://aiapi-prod.stanford.edu/v1/"
            },
            "models": {
                "claude-4-sonnet": {
                    "name": "Claude 4 Sonnet",
                    "limit": {
                        "context": 200000,
                        "output": 65536
                    }
                },
                "gpt-5": {
                    "name": "GPT--5",
                    "limit": {
                        "context": 200000,
                        "output": 65536
                    }
                },
                "gpt-5-mini": {
                    "name": "GPT--5-mini",
                    "limit": {
                        "context": 200000,
                        "output": 65536
                    }
                },
                "gemini-2.5-pro": {
                    "name": "Gemini 2.5 Pro",
                    "limit": {
                        "context": 200000,
                        "output": 65536
                    }
                }
            }
        }
    },

Weirdly, gemini-2.5-pro still works for some reason.

OpenCode version

v1.0.86

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @moritzschaefer on GitHub (Nov 21, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Starting from version v1.0.86 (v1.0.85 is still fine), I get the following error: ``` ┃ litellm.BadRequestError: AzureException BadRequestError - Unknown parameter: 'usage'.. ' Received Model Group=gpt-5 Available Model Group Fallbacks=None ``` The caveat: I use an API wrapper from my organization (Stanford), which lags behind the API features of public providers. I configured `opencode` to use OpenRouter, which started breaking upon v1.0.86. Is there a way to explicitly use the legacy OpenAI API? Here is my opencode config: ``` "provider": { "openrouter": { "options": { "baseURL": "https://aiapi-prod.stanford.edu/v1/" }, "models": { "claude-4-sonnet": { "name": "Claude 4 Sonnet", "limit": { "context": 200000, "output": 65536 } }, "gpt-5": { "name": "GPT--5", "limit": { "context": 200000, "output": 65536 } }, "gpt-5-mini": { "name": "GPT--5-mini", "limit": { "context": 200000, "output": 65536 } }, "gemini-2.5-pro": { "name": "Gemini 2.5 Pro", "limit": { "context": 200000, "output": 65536 } } } } }, ``` Weirdly, `gemini-2.5-pro` still works for some reason. ### OpenCode version v1.0.86 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:38:22 -05:00
yindo closed this issue 2026-02-16 17:38:22 -05:00
Author
Owner

@rekram1-node commented on GitHub (Nov 22, 2025):

@moritzschaefer hm why do you call the provider openrouter if it isnt going to openrouter

@rekram1-node commented on GitHub (Nov 22, 2025): @moritzschaefer hm why do you call the provider openrouter if it isnt going to openrouter
Author
Owner

@rekram1-node commented on GitHub (Nov 22, 2025):

if u rename it to something else and set:

npm: @ais-sdk/openai-compatible

then it should all work ig i can do something to fix for u but naming the provider openrouter makes our logic behave weirdly

@rekram1-node commented on GitHub (Nov 22, 2025): if u rename it to something else and set: npm: @ais-sdk/openai-compatible then it should all work ig i can do something to fix for u but naming the provider openrouter makes our logic behave weirdly
Author
Owner

@moritzschaefer commented on GitHub (Nov 22, 2025):

Hi, thanks for the swift response! Yes, I chose openrouter previously as I suspected it to follow a more legacy-ee version of the OpenAI API and it did the job.

Great to hear that there is a better solution. Could you please elaborate though?

What should I rename?
And what do you mean by npm: @ais-sdk/openai-compatible? (I tried installing it with npm i, but it doesn't exist). Sorry, I am not familiar with the frameworks..

@moritzschaefer commented on GitHub (Nov 22, 2025): Hi, thanks for the swift response! Yes, I chose openrouter previously as I suspected it to follow a more legacy-ee version of the OpenAI API and it did the job. Great to hear that there is a better solution. Could you please elaborate though? What should I rename? And what do you mean by `npm: @ais-sdk/openai-compatible`? (I tried installing it with `npm i`, but it doesn't exist). Sorry, I am not familiar with the frameworks..
Author
Owner

@rekram1-node commented on GitHub (Nov 22, 2025):

@moritzschaefer try this:

 "provider": {
    "stanford": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://aiapi-prod.stanford.edu/v1/",
      },
      "models": {
        "claude-4-sonnet": {
          "name": "Claude 4 Sonnet",
          "limit": {
            "context": 200000,
            "output": 65536,
          },
        },
        "gpt-5": {
          "name": "GPT--5",
          "limit": {
            "context": 200000,
            "output": 65536,
          },
        },
        "gpt-5-mini": {
          "name": "GPT--5-mini",
          "limit": {
            "context": 200000,
            "output": 65536,
          },
        },
        "gemini-2.5-pro": {
          "name": "Gemini 2.5 Pro",
          "limit": {
            "context": 200000,
            "output": 65536,
          },
        },
      },
    },
  },

Now note: I assume you have an api key for this? You will need to do:
opencode auth login

Select other
Type in "stanford"

and paste ur key

You could also instead just edit ~/.local/share/opencode/auth.json and change "openrouter" to "stanford"

Note: I am just renaming ur provider it doesnt have to be stanford, just try to avoid calling it something it isn't

@rekram1-node commented on GitHub (Nov 22, 2025): @moritzschaefer try this: ``` "provider": { "stanford": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "https://aiapi-prod.stanford.edu/v1/", }, "models": { "claude-4-sonnet": { "name": "Claude 4 Sonnet", "limit": { "context": 200000, "output": 65536, }, }, "gpt-5": { "name": "GPT--5", "limit": { "context": 200000, "output": 65536, }, }, "gpt-5-mini": { "name": "GPT--5-mini", "limit": { "context": 200000, "output": 65536, }, }, "gemini-2.5-pro": { "name": "Gemini 2.5 Pro", "limit": { "context": 200000, "output": 65536, }, }, }, }, }, ``` Now note: I assume you have an api key for this? You will need to do: `opencode auth login` Select other Type in "stanford" and paste ur key You could also instead just edit ~/.local/share/opencode/auth.json and change "openrouter" to "stanford" Note: I am just renaming ur provider it doesnt have to be stanford, just try to avoid calling it something it isn't
Author
Owner

@moritzschaefer commented on GitHub (Nov 22, 2025):

Worked! Thanks a ton!

@moritzschaefer commented on GitHub (Nov 22, 2025): Worked! Thanks a ton!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3048