LiteLLM Proxy: Vertex AI Gemini models fail for tools with empty parameters #6692

Open
opened 2026-02-16 18:04:58 -05:00 by yindo · 3 comments
Owner

Originally created by @wenkangjing on GitHub (Jan 18, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When using OpenCode with LiteLLM proxy configured for Vertex AI Gemini models (e.g., gemini-3-pro-image-preview), tool calls fail because function declarations with empty parameters don't include "type": "object" in the parameters schema. Vertex AI strictly requires this field, while OpenAI-compatible APIs typically accept schemas without it.

Error Message

litellm.ServiceUnavailableError: litellm.BadRequestError: Vertex_ai_betaException BadRequestError - 
{
  "error": {
    "code": 400,
    "message": "Unable to submit request because `todoread` functionDeclaration parameters schema should be of type OBJECT. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling",
    "status": "INVALID_ARGUMENT"
  }
}

Vertex AI Gemini requires:

{
  name: todoread,
  description: Use this tool to read your todo list,
  parameters: {
    type: object,  // ← REQUIRED
    properties: {},
    required: []
  }
}

Provider Settings

  "provider": {
    "a-ramdon-name": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "a ramdon name",
      "options": {
        "baseURL": "{baseUIL}/v1",
        "apiKey": "a litellm key"
      },
      "models": {
        "gemini-3-pro-image-preview": {
          "name": "gemini-3-pro-image-preview"
        }
      }
    }

Proposed Solution

When serializing tool schemas for Vertex AI models, ensure, always include "type": "object" in parameters schema

Plugins

Oh My OpenCode

OpenCode version

1.1.25

Steps to reproduce

  1. Configure LiteLLM proxy with a Vertex AI Gemini model
  2. Ask OpenCode to generate a random image
  3. Observe the Vertex AI 400 error

Screenshot and/or share link

https://opncd.ai/share/Ud6K8Z1N

Operating System

macOS SequoiaVersion 15.7.3

Terminal

Ghostty

Originally created by @wenkangjing on GitHub (Jan 18, 2026). Originally assigned to: @thdxr on GitHub. ### Description When using OpenCode with LiteLLM proxy configured for Vertex AI Gemini models (e.g., gemini-3-pro-image-preview), tool calls fail because function declarations with empty parameters don't include `"type": "object"` in the parameters schema. Vertex AI strictly requires this field, while OpenAI-compatible APIs typically accept schemas without it. **Error Message** ``` litellm.ServiceUnavailableError: litellm.BadRequestError: Vertex_ai_betaException BadRequestError - { "error": { "code": 400, "message": "Unable to submit request because `todoread` functionDeclaration parameters schema should be of type OBJECT. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling", "status": "INVALID_ARGUMENT" } } ``` Vertex AI Gemini requires: ``` { name: todoread, description: Use this tool to read your todo list, parameters: { type: object, // ← REQUIRED properties: {}, required: [] } } ``` **Provider Settings** ``` "provider": { "a-ramdon-name": { "npm": "@ai-sdk/openai-compatible", "name": "a ramdon name", "options": { "baseURL": "{baseUIL}/v1", "apiKey": "a litellm key" }, "models": { "gemini-3-pro-image-preview": { "name": "gemini-3-pro-image-preview" } } } ``` **Proposed Solution** When serializing tool schemas for Vertex AI models, ensure, always include "type": "object" in parameters schema ### Plugins Oh My OpenCode ### OpenCode version 1.1.25 ### Steps to reproduce 1. Configure LiteLLM proxy with a Vertex AI Gemini model 2. Ask OpenCode to generate a random image 3. Observe the Vertex AI 400 error ### Screenshot and/or share link https://opncd.ai/share/Ud6K8Z1N ### Operating System macOS SequoiaVersion 15.7.3 ### Terminal Ghostty
yindo added the bug label 2026-02-16 18:04:58 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 18, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #8184: Strict JSON Schema validation fail on backends like SGLang (Missing required field in empty tool parameters)
  • #9020: Claude models fail on MCP tools with no required parameters (undefined vs {})
  • #9131: [BUG]: todoread tool missing schema causes 400 error with Antigravity API

All of these issues relate to tools with empty parameters not including the required "type": "object" field in the parameters schema, which causes validation failures on strict backends like Vertex AI, SGLang, Antigravity API, and others.

Feel free to ignore if your specific case differs from these issues.

@github-actions[bot] commented on GitHub (Jan 18, 2026): This issue might be a duplicate of existing issues. Please check: - #8184: Strict JSON Schema validation fail on backends like SGLang (Missing required field in empty tool parameters) - #9020: Claude models fail on MCP tools with no required parameters (undefined vs {}) - #9131: [BUG]: todoread tool missing schema causes 400 error with Antigravity API All of these issues relate to tools with empty parameters not including the required "type": "object" field in the parameters schema, which causes validation failures on strict backends like Vertex AI, SGLang, Antigravity API, and others. Feel free to ignore if your specific case differs from these issues.
Author
Owner

@geoHeil commented on GitHub (Jan 19, 2026):

even without the image - even when texting Hi it fails for me. Is there any workaround?

@geoHeil commented on GitHub (Jan 19, 2026): even without the image - even when texting Hi it fails for me. Is there any workaround?
Author
Owner

@wenkangjing commented on GitHub (Jan 20, 2026):

the same behaviour on my side, just "Hi", no images fails as well.

@wenkangjing commented on GitHub (Jan 20, 2026): the same behaviour on my side, just "Hi", no images fails as well.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6692