claude-code-router icon indicating copy to clipboard operation
claude-code-router copied to clipboard

Can't use gemini-3-pro-preview from Openrouter

Open djeidy opened this issue 1 month ago • 16 comments

I get the error bellow when I try to use gemini-3-pro-preview from Openrouter. Is there any work around? API Error: 400 {"error":{"message":"Error from provider(openrouter,google/gemini-3-pro-preview: 400): {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"Gemini models require OpenRouter reasoning details to be preserved in each request. Please refer to our docs: https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning-blocks. Upstream error: {\n \"error\": {\n \"code\": 400,\n \"message\": \"Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call default_api:TodoWrite , position 2. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.\",\n
\"status\": \"INVALID_ARGUMENT\"\n }\n}\n","provider_name":"Google AI Studio"}},"user_id":"user_2dOv1J5wtMvwXLCnuCxFMLblqu5"}Error: Error from provider(openrouter,google/gemini-3-pro-preview: 400): {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"Gemini models require OpenRouter reasoning details to be preserved in each request. Please refer to our docs: https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning-blocks. Upstream error: {\n
\"error\": {\n \"code\": 400,\n \"message\": \"Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call default_api:TodoWrite , position 2. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n","provider_name":"Google AI Studio"}},"user_id":"user_2dOv1J5wtMvwXLCnuCxFMLblqu5"}\n at nt (/opt/homebrew/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:79940:11)\n at p0 (/opt/homebrew/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:80000:11)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async f0 (/opt/homebrew/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:79965:96)","type":"api_error","code":"provider_response_error"}}

djeidy avatar Nov 22 '25 01:11 djeidy

having the same issue

Tried in both mac os and windows

Dixith-dev avatar Nov 22 '25 11:11 Dixith-dev

same issue

Mng-dev-ai avatar Nov 22 '25 14:11 Mng-dev-ai

same issue

aostock avatar Nov 22 '25 15:11 aostock

+1

pavank avatar Nov 22 '25 19:11 pavank

same issue

kaankeskin avatar Nov 22 '25 20:11 kaankeskin

same issue

hellerchr avatar Nov 22 '25 23:11 hellerchr

same

ayhamakeed2000 avatar Nov 23 '25 07:11 ayhamakeed2000

I dug a lil deeper guys, it seems like an openrouter issue

Dixith-dev avatar Nov 23 '25 11:11 Dixith-dev

I dug a lil deeper guys, it seems like an openrouter issue

Thank you very much for checking. So It should be fix from OpenRouter end?

djeidy avatar Nov 23 '25 18:11 djeidy

yeah most likely

The same issue is present in opencode as well when using it with the openrouter google endpoint

Opencode team said they reached out to openrouter team and reported they will be fixing soon

So my guess would be 1-2 days max, if they wont fix it ill make a new router and try to find a workaround :)

Dixith-dev avatar Nov 23 '25 18:11 Dixith-dev

gemini-3-pro-preview is work now

aostock avatar Nov 25 '25 05:11 aostock

gemini-3-pro-preview is work now

can you please share your config.json?

popsteve avatar Nov 25 '25 07:11 popsteve

Same issue still happening after 1.0.71 release

API Error: 400 {"error":{"message":"Error from provider(openrouter,google/gemini-3-pro-preview: 400): {\"error\":{\"message\":\"Provider returned 
    error\",\"code\":400,\"metadata\":{\"raw\":\"Gemini models require OpenRouter reasoning details to be preserved in each request. Please refer to our docs: 
    https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning-blocks. Upstream error: {\\n  \\\"error\\\": {\\n    \\\"code\\\": 400,\\n    \\\"message\\\": 
    \\\"Unable to submit request because function call `default_api:TodoWrite` in the 4. content block is missing a `thought_signature`. Learn more: 
    https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures\\\",\\n    \\\"status\\\": \\\"INVALID_ARGUMENT\\\"\\n  
    }\\n}\\n\",\"provider_name\":\"Google\"}},\"user_id\":\"user_xxxxxxxxxxxx\"}Error: Error from provider(openrouter,google/gemini-3-pro-preview: 400): 
    {\"error\":{\"message\":\"Provider returned error\",\"code\":400,\"metadata\":{\"raw\":\"Gemini models require OpenRouter reasoning details to be preserved in each request. 
    Please refer to our docs: https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning-blocks. Upstream error: {\\n  \\\"error\\\": {\\n    \\\"code\\\": 400,\\n
        \\\"message\\\": \\\"Unable to submit request because function call `default_api:TodoWrite` in the 4. content block is missing a `thought_signature`. Learn more: 
    https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures\\\",\\n    \\\"status\\\": \\\"INVALID_ARGUMENT\\\"\\n  
    }\\n}\\n\",\"provider_name\":\"Google\"}},\"user_id\":\"user_xxxxxxxxxxxx\"}\n    at nt 
    (/opt/homebrew/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:79940:11)\n    at p0 
    (/opt/homebrew/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:80000:11)\n    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n    
    at async f0 (/opt/homebrew/lib/node_modules/@musistudio/claude-code-router/dist/cli.js:79965:96)","type":"api_error","code":"provider_response_error"}}

Config

{
  "LOG": false,
  "Providers": [
    {
      "name": "openrouter",
      "api_base_url": "https://openrouter.ai/api/v1/chat/completions",
      "api_key": "sk-or-v1-xxxxxxxxxxxxxxx",
      "models": ["google/gemini-3-pro-preview"],
      "transformer": { "use": ["openrouter"] }
    }
  ],
  "Router": {
    "default": "openrouter,google/gemini-3-pro-preview",
    "background": "openrouter,google/gemini-3-pro-preview",
    "think": "openrouter,google/gemini-3-pro-preview",
    "longContext": "openrouter,google/gemini-3-pro-preview",
    "webSearch": "openrouter,google/gemini-3-pro-preview:online"
  }
}

thesobercoder avatar Nov 25 '25 18:11 thesobercoder

It’s still not working. Is there any further updates?

GeeJoe avatar Nov 27 '25 06:11 GeeJoe

I dont think gemini 3 support will roll out soon guys but there is another router called "claudish" that supports gemini 3 if you guys want to check it out :)

Dixith-dev avatar Dec 01 '25 16:12 Dixith-dev

+1

YSMull avatar Dec 02 '25 06:12 YSMull

the fix is to cache gemini reasoning in a file and inject it in the tool calls in the next request i created a fastapi server for that because i don't need the full cli wrapper, you can see how i did it and do the same https://github.com/Mng-dev-ai/anthropic-bridge/blob/main/anthropic_bridge/client.py#L94

Mng-dev-ai avatar Dec 15 '25 14:12 Mng-dev-ai