forked from router-for-me/CLIProxyAPI
-
-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Description
Bug Description
When using Antigravity (Droid Factory) with Gemini models via the OpenAI Responses API, requests fail with:
400 Invalid value at 'request.tools[0].function_declarations[19].parameters.properties[3].value.type'
(type.googleapis.com/google.cloud.aiplatform.master.Type), "["STRING","NULL"]"
This happens when tool schemas include nullable types like "type": ["string", "null"] (which Claude Code and other OpenAI-compatible tools commonly send).
Root Cause
In internal/translator/gemini/openai/responses/gemini_openai-responses_request.go, lines 333-348:
if propType := value.Get("type"); propType.Exists() {
upperType := strings.ToUpper(propType.String())
cleaned, _ = sjson.Set(cleaned, "properties."+key.String()+".type", upperType)
}When type is a JSON array ["string", "null"]:
gjson.Result.String()returns raw text["string","null"]strings.ToUpper()→["STRING","NULL"]sjson.Set()stores it as a JSON string"[\"STRING\",\"NULL\"]"— not a JSON array- Downstream
flattenTypeArrays()skips it becauseIsArray()returnsfalseon a string - Gemini API rejects the invalid type value
Additionally, this code only iterates top-level properties — nested schemas with type arrays are not processed at all.
Suggested Fix
Remove the type uppercasing block (lines 333-348) and pass the raw schema directly:
if params := tool.Get("parameters"); params.Exists() {
funcDecl, _ = sjson.SetRaw(funcDecl, "parametersJsonSchema", params.Raw)
}This is safe because:
- Antigravity executor already runs
CleanJSONSchemaForGemini()which properly handles type arrays, nullable fields, and all schema cleanup - Gemini/Vertex executors use
parametersJsonSchemawhich accepts raw JSON Schema directly (no uppercasing needed) - The uppercasing logic was redundant and incomplete (top-level only)
- No impact on other models or executors
Verified
Built and deployed the fix locally. Tested with Droid Factory (Antigravity) Gemini models — the error no longer occurs.
Fix PR
Environment
- Client: Claude Code (OpenAI Responses API format)
- Provider: Antigravity / Droid Factory
- Models: Gemini models via Antigravity
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels