opencode
opencode copied to clipboard
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