Skip to content

github copilot: Gemini 3.0 invalid body request #4468

Closed

Description

@furkan-bayram132

Description

When i prompt Github Copilot gemini 3.0 to do anything in build mode, it ends up with "invalid request body" error.

OpenCode version

1.0.76

Steps to reproduce

  1. Select github copilot gemini 3.0 preview
  2. Prompt something like download a youtube video for me
  3. receive invalid request body

Screenshot and/or share link

Image

Operating System

Ubuntu 22.04

Terminal

Ubuntu bash, terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 18, 2025
  2. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Contributor

    @furkan-bayram132 did you enable it in your copilot settings? Also note that some of their api is down and could be causing issues too

  3. self-assigned this
    on Nov 18, 2025
  4. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 18, 2025
  5. changed the title [-]Gemini 3.0 Invalid[/-] [+]Gemini 3.0 invalid body request[/+] on Nov 18, 2025
  6. furkan-bayram132 commented on Nov 18, 2025

    @furkan-bayram132
    Author

    @rekram1-node yes i enabled it

  7. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Contributor

    Do u have any mcp servers? Their api may be erroring due tot hat

  8. joskfg commented on Nov 18, 2025

    @joskfg

    I'm having the same issue and it is failing when I ask to contact the context7 MCP server.

  9. furkan-bayram132 commented on Nov 18, 2025

    @furkan-bayram132
    Author

    i don't have any mcp servers

  10. rversteegen commented on Nov 18, 2025

    @rversteegen

    I see the same thing in opencode 0.15.31 (I see a lot of bugs constantly fixed in 1.x so thought I'd wait a little). No MCP or LSP servers here.
    And as mentioned on your X post, Gemini 3 in Zen is also throwing that Generative AI API key error.

  11. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Contributor

    @rversteegen can u show me opencode auth list

    and then try:

    opencode run hello --print-logs --model opencode/gemini-3-pro

  12. rversteegen commented on Nov 18, 2025

    @rversteegen

    Oh, noone mentioned this detail yet: the agent always performs one tool call successfully, and then shows the error. I tell it to continue and it repeats:

    Image
    > opencode auth list
    
    ┌  Credentials ~/.local/share/opencode/auth.json
    │
    ●  GitHub Copilot oauth
    │
    ●  OpenRouter api
    │
    └  2 credentials
    
    > opencode run hello --print-logs --model opencode/gemini-3-pro
    INFO  2025-11-18T23:52:23 +202ms service=default version=0.15.31 args=["run","hello","--print-logs","--model","opencode/gemini-3-pro"] opencode
    INFO  2025-11-18T23:52:23 +1ms service=project directory=/home/ralph/gemtest fromDirectory
    INFO  2025-11-18T23:52:23 +22ms service=config path=/home/ralph/.config/opencode/config.json loading
    INFO  2025-11-18T23:52:23 +1ms service=config path=/home/ralph/.config/opencode/opencode.json loading
    INFO  2025-11-18T23:52:23 +26ms service=config path=/home/ralph/.config/opencode/opencode.jsonc loading
    INFO  2025-11-18T23:52:23 +6ms service=bun cmd=["/home/ralph/.local/lib64/node_modules/opencode-ai/node_modules/opencode-linux-x64/bin/opencode","add","@opencode-ai/plugin@0.15.31","--exact"] cwd=/home/ralph/.config/opencode running
    INFO  2025-11-18T23:52:23 +8ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)
    
    installed @opencode-ai/plugin@0.15.31
    
    [2.00ms] done
     stderr=Saved lockfile
     done
    INFO  2025-11-18T23:52:23 +1ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin
    INFO  2025-11-18T23:52:23 +1ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
    INFO  2025-11-18T23:52:23 +23ms service=bus type=* subscribing
    INFO  2025-11-18T23:52:23 +0ms service=bus type=session.updated subscribing
    INFO  2025-11-18T23:52:23 +0ms service=bus type=message.updated subscribing
    INFO  2025-11-18T23:52:23 +0ms service=bus type=message.part.updated subscribing
    INFO  2025-11-18T23:52:23 +0ms service=format init
    INFO  2025-11-18T23:52:23 +0ms service=bus type=file.edited subscribing
    INFO  2025-11-18T23:52:23 +1ms service=lsp serverIds=deno, typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, astro, jdtls, lua-ls enabled LSP servers
    INFO  2025-11-18T23:52:23 +3ms service=session id=ses_5669dc3c1ffeNm69AFXcV8UC9z version=0.15.31 projectID=global directory=/home/ralph/gemtest title=New session - 2025-11-18T23:52:23.358Z time={"created":1763509943358,"updated":1763509943358} created
    INFO  2025-11-18T23:52:23 +1ms service=bus type=session.created publishing
    INFO  2025-11-18T23:52:23 +0ms service=bus type=session.updated publishing
    INFO  2025-11-18T23:52:23 +2ms service=bus type=message.part.updated subscribing
    INFO  2025-11-18T23:52:23 +0ms service=bus type=session.error subscribing
    INFO  2025-11-18T23:52:23 +0ms service=bus type=permission.updated subscribing
    INFO  2025-11-18T23:52:23 +1ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z prompt
    INFO  2025-11-18T23:52:23 +7ms service=bus type=message.updated publishing
    INFO  2025-11-18T23:52:23 +7ms service=bus type=message.part.updated publishing
    INFO  2025-11-18T23:52:23 +2ms service=bus type=session.updated publishing
    INFO  2025-11-18T23:52:23 +3ms service=models.dev file={} refreshing
    INFO  2025-11-18T23:52:23 +3ms service=provider init
    INFO  2025-11-18T23:52:23 +9ms service=provider providerID=openrouter found
    INFO  2025-11-18T23:52:23 +0ms service=provider providerID=opencode found
    INFO  2025-11-18T23:52:23 +0ms service=provider providerID=github-copilot found
    INFO  2025-11-18T23:52:23 +0ms service=provider providerID=copilot-api found
    INFO  2025-11-18T23:52:23 +1ms service=provider providerID=opencode modelID=gemini-3-pro getModel
    INFO  2025-11-18T23:52:23 +0ms service=provider status=started providerID=opencode getSDK
    INFO  2025-11-18T23:52:23 +78ms service=provider status=completed duration=78 providerID=opencode getSDK
    INFO  2025-11-18T23:52:23 +1ms service=provider providerID=opencode modelID=gemini-3-pro found
    INFO  2025-11-18T23:52:23 +0ms service=session.lock sessionID=ses_5669dc3c1ffeNm69AFXcV8UC9z locked
    INFO  2025-11-18T23:52:23 +0ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z sessionID=ses_5669dc3c1ffeNm69AFXcV8UC9z locking
    INFO  2025-11-18T23:52:23 +19ms service=bus type=message.updated publishing
    INFO  2025-11-18T23:52:23 +14ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z process
    INFO  2025-11-18T23:52:23 +1ms service=provider providerID=opencode modelID=gpt-5-nano getModel
    INFO  2025-11-18T23:52:23 +0ms service=provider status=started providerID=opencode getSDK
    INFO  2025-11-18T23:52:23 +4ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z type=start part
    ERROR 2025-11-18T23:52:23 +6ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z error={"error":{"name":"AI_LoadAPIKeyError"}} stream error
    INFO  2025-11-18T23:52:23 +1ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z type=error part
    ERROR 2025-11-18T23:52:23 +0ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z error=Google Generative AI API key is missing. Pass it using the 'apiKey' parameter or the GOOGLE_GENERATIVE_AI_API_KEY environment variable. process
    INFO  2025-11-18T23:52:23 +1ms service=bus type=session.error publishing
    Error: Google Generative AI API key is missing. Pass it using the 'apiKey' parameter or the GOOGLE_GENERATIVE_AI_API_KEY environment variable.
    INFO  2025-11-18T23:52:23 +8ms service=provider status=completed duration=20 providerID=opencode getSDK
    INFO  2025-11-18T23:52:23 +0ms service=provider providerID=opencode modelID=gpt-5-nano found
    ERROR 2025-11-18T23:52:23 +12ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z error=OpenAI API key is missing. Pass it using the 'apiKey' parameter or the OPENAI_API_KEY environment variable. model=gpt-5-nano failed to generate title
    INFO  2025-11-18T23:52:23 +1ms service=bus type=message.updated publishing
    INFO  2025-11-18T23:52:23 +1ms service=bus type=message.updated publishing
    INFO  2025-11-18T23:52:23 +0ms service=session.compaction pruning
    INFO  2025-11-18T23:52:23 +1ms service=session.lock sessionID=ses_5669dc3c1ffeNm69AFXcV8UC9z unlocked
    INFO  2025-11-18T23:52:23 +0ms service=session.prompt session=ses_5669dc3c1ffeNm69AFXcV8UC9z sessionID=ses_5669dc3c1ffeNm69AFXcV8UC9z unlocking
    
  13. rversteegen commented on Nov 19, 2025

    @rversteegen

    I see a model=gpt-5-nano failed to generate title API error in there, but the titles do generate just fine when not using opencode/gemini-3-pro, so I guess it's because the whole session is errored.
    Anyway it's about time I upgraded to opencode 1.x unless you want me to continue testing with 0.15 for any reason.

  14. nerdeveloper commented on Nov 19, 2025

    @nerdeveloper

    i am having this same error, using the latest version of opencode

  15. 22 remaining items

  16. dkEwenSELLITTO commented on Dec 3, 2025

    @dkEwenSELLITTO

    Same error on

    ❯ opencode --version
    1.0.128

    MacOS 26.1

    but I don't see any error with this command :
    opencode run hello --print-logs --model github-copilot/gemini-3-pro-preview

    I just get errors after a tool use

  17. rekram1-node commented on Dec 3, 2025

    @rekram1-node
    Contributor

    yep known issue

  18. aadishv commented on Dec 10, 2025

    @aadishv

    It mysteriously seems to work for me now, even though it doesn't seem there have been any changes on OpenCode side that could have fixed it. Might just be that Copilot loosened their APIs a little although that still doesn't make much sense (as how else are they getting the thought signatures to give Google?). I'll look into it some more but we can probably close this issue now.

    [screenshot from OC 1.0.142]

    Image
  19. rekram1-node commented on Dec 10, 2025

    @rekram1-node
    Contributor

    Yeah idk either but it does work

  20. aadishv commented on Dec 10, 2025

    @aadishv
    Image

    okay it works on my clone where I'm very sure it wasn't working previously so definitely a change on the Copilot API side. I'm still curious about how they have this implemented but, oh well, it works :)

    @rekram1-node would you prefer I still make a PR just to implement thinking blocks for Copilot models?

  21. rekram1-node commented on Dec 10, 2025

    @rekram1-node
    Contributor

    @aadishv well let's talk through it, is it a huge change? what do u need to set to get reasoning to come back?

  22. aadishv commented on Dec 10, 2025

    @aadishv

    @aadishv well let's talk through it, is it a huge change? what do u need to set to get reasoning to come back?

    Yeah that's the biggest thing that is making me unsure. it requires basically cloning the entire openai compatible /chat/completions implementation, like we've already done for /responses. the modifications for thinking are very minimal its basically +1-1

  23. rekram1-node commented on Dec 10, 2025

    @rekram1-node
    Contributor

    What's the change tho? What did you need to set?

  24. aadishv commented on Dec 10, 2025

    @aadishv

    requires adding this to the chunk schema:

    Image

    and this to the doStream function (I haven't updated doGenerate yet):

    Image
  25. aadishv commented on Dec 10, 2025

    @aadishv

    Okay just added it to doGenerate as well, it's very similar changes to the relevant schemas and methods

  26. rekram1-node commented on Dec 10, 2025

    @rekram1-node
    Contributor

    Hm ig guess u can pr it, kinda annoying we need a whole fork of compatible provider too.

  27. aadishv commented on Dec 10, 2025

    @aadishv

    yeah definitely, i'll make a pr, you can choose whether to merge or not :)

  28. jcubic commented on Dec 10, 2025

    @jcubic

    Do other methods in Copilot have reasoning? I use Sonnet 4.5 most of the time. And thinking toggle does nothing (at least it used to). Can Copilot models even use reasoning? I'm not sure which models are reasoning and which are not.

  29. aadishv commented on Dec 10, 2025

    @aadishv

    Do other methods in Copilot have reasoning? I use Sonnet 4.5 most of the time. And thinking toggle does nothing (at least it used to). Can Copilot models even use reasoning? I'm not sure which models are reasoning and which are not.

    I'm pretty sure that Sonnet and Opus are ran without thinking, Gemini 3 Pro is with auto reasoning, and GPT-5.1 family is with medium. Codex models also think (afaik) but I'm not sure if their traces are accessible via the responses API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions