You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]:Support Gemini API by trimming/adapting tool descriptions #9570
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
When using Gemini models (via @ai-sdk/openai-compatible or direct proxy), any tool invocation fails with:
Request contains an invalid argument (400)
This happens because:
OpenCode's tool descriptions are very long (~4000+ chars for bash tool)
Gemini API has stricter limits on function description length
Normal chat works, but any tool call triggers the error
Environment
OpenCode version: 1.1.26
Provider: Gemini 3 Pro via openai-compatible proxy
OS: Windows
Expected Behavior
Gemini should work as a model provider with tool calling support.
Suggested Solution
Add provider-specific tool description trimming in transform.ts, similar to existing normalizeMessages() for Anthropic/Mistral:
if(model.api.id.includes("gemini")){// Trim tool descriptions to Gemini's limits}AdditionalContext•ClaudeandOpenAIworkfinewithcurrenttooldescriptions•Thisaffectsallagents(Sisyphus,Build,etc.)-notagent-specific•Errorlogattached[error-v1-chat-completions-2026-01-20T142434-138bff82.log](https://github.com/user-attachments/files/24732436/error-v1-chat-completions-2026-01-20T142434-138bff82.log)
These issues relate to Gemini API compatibility problems with tool descriptions and parameters validation. Issue #9233 and #8184 specifically address similar errors with Gemini models failing on tool validation, and #5715 discusses the bash tool description being too long for certain providers.
Feel free to ignore if none of these address your specific case.
Activity
github-actions commentedon Jan 20, 2026
This issue might be a duplicate of existing issues. Please check:
These issues relate to Gemini API compatibility problems with tool descriptions and parameters validation. Issue #9233 and #8184 specifically address similar errors with Gemini models failing on tool validation, and #5715 discusses the bash tool description being too long for certain providers.
Feel free to ignore if none of these address your specific case.
github-actions commentedon Mar 26, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
jayteaftw commentedon Apr 7, 2026
Hey why was this closed? Was this fixed? Im still experiencing this in 1.3.17