Skip to content

Custom provider, calling Gemini model with Google SDK results in unexpected interruptions. #13780

@Sallyn0225

Description

@Sallyn0225

Description

When using the Gemini model, it sometimes abruptly stops during tool calls, and at other times, it stops while thinking. However, with the same upstream source, if connected to chat tools like Chatbox or platforms like Kilo Code, it functions normally, so upstream issues can likely be ruled out.

I also used an AI gateway like AxonHub to check the logs. I can see a message indicating a stop with input but no output, and a specific response body is as follows:

Image
{
  "candidates": [
    {
      "index": 0,
      "content": {
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ],
  "responseId": "18CRacGiPIuxjuMPw_mKkAk",
  "modelVersion": "gemini-3-flash-preview",
  "usageMetadata": {
    "totalTokenCount": 22066,
    "promptTokenCount": 22066
  }
}

The "finishReason": "STOP" in the middle caught my attention, and it seems to be the cause of the abrupt termination of output.

Plugins

oh-my-opencode, opencode-axonhub-tracing

OpenCode version

1.2.4

Steps to reproduce

  1. Use custom channels, use Google's SDK
  2. When calling Gemini series models, there is a probability of sudden interruption. However, it will not suddenly interrupt when the model outputs text.

Screenshot and/or share link

Image

Operating System

Windows 11 WSL2 Debian

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwindows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions