Skip to content

Upgrade @ai-sdk/openai-compatible to 2.x to fix Gemini streaming tool_calls validation error #17902

Closed

Description

@wangwenchao03

Description

Problem: When using custom OpenAI-compatible providers that route to Google Gemini, streaming tool_calls fail with
AI_TypeValidationError because Gemini's response omits the index field in tool_call chunks.

The bundled version in v1.2.27 is @ai-sdk/[email protected], which requires index: z.number() (strict).

Fix already exists: @ai-sdk/[email protected] changed it to index: z.number().nullish() with the comment //google
does not send index.

To verify current bundled version:
strings ~/.opencode/bin/opencode | grep -oE 'openai-compatible@[0-9]+.[0-9]+.[0-9]+' | sort -uV

Plugins

No response

OpenCode version

1.2.27

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

No response

Terminal

No response

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 17, 2026
  2. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  3. rekram1-node commented on May 13, 2026

    @rekram1-node
    Collaborator

    we use:
    "@ai-sdk/openai-compatible": "2.0.41",

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions