LiteLLM Proxy: Vertex AI Gemini models fail for tools with empty parameters
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
- Configure LiteLLM proxy with a Vertex AI Gemini model
- Ask OpenCode to generate a random image
- 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
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.