Skip to content

Vertex Gemini models tool calls fail on /v1/responses #2549

@dhaern

Description

@dhaern

Is it a request payload issue?
[x] Yes, this is a request payload issue. I am using a client/cURL to send a request payload, but I received an unexpected error.
[ ] No, it's another issue.

If it's a request payload issue, you MUST know
Our team doesn't have any GODs or ORACLEs or MIND READERs. Please make sure to attach the request log or curl payload.

Describe the bug
When using Vertex Gemini models through vertex-api-key, tool usage works through /v1/chat/completions but fails through /v1/responses.

The failure happens when the request includes function_call / function_call_output items. Vertex rejects the translated Gemini payload with:

  • Unknown name "id" at 'contents[...].parts[...].function_call'
  • Unknown name "id" at 'contents[...].parts[...].function_response'

This appears to be a translator bug in the OpenAI Responses -> Gemini request conversion for Vertex/Gemini.

CLI Type
vertex-api-key (openai-compatibility)

Model Name
gemini-3.1-pro-preview

LLM Client
OpenCode

Request Information
Minimal reproduction that fails on /v1/responses:

curl -sS http://127.0.0.1:<PORT>/v1/responses \
  -H 'Authorization: Bearer <REDACTED>' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gemini-3.1-pro-preview",
    "input": [
      {
        "type": "message",
        "role": "user",
        "content": [
          { "type": "input_text", "text": "Call noop" }
        ]
      },
      {
        "type": "function_call",
        "call_id": "call_1",
        "name": "noop",
        "arguments": "{}"
      },
      {
        "type": "function_call_output",
        "call_id": "call_1",
        "output": "{}"
      }
    ]
  }'

Returned error:

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"id\" at 'contents[1].parts[0].function_call': Cannot find field.\nInvalid JSON payload received. Unknown name \"id\" at 'contents[2].parts[0].function_response': Cannot find field."
  }
}

Equivalent flow that works on /v1/chat/completions:

curl -sS http://127.0.0.1:<PORT>/v1/chat/completions \
  -H 'Authorization: Bearer <REDACTED>' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gemini-3.1-pro-preview",
    "messages": [
      { "role": "user", "content": "Call noop" }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "noop",
          "description": "No-op",
          "parameters": {
            "type": "object",
            "properties": {},
            "additionalProperties": false
          }
        }
      }
    ],
    "tool_choice": "auto",
    "stream": false
  }'

That returns a normal tool call response.

Expected behavior
/v1/responses should also work for Vertex Gemini tool flows and should not emit Gemini payload fields that Vertex rejects.

Screenshots
N/A

OS Type

  • OS: Ubuntu
  • Version: 24.04 LTS ARM64

Additional context
I traced the issue to the Gemini responses request translator adding fields that Vertex does not accept in this schema:

  • functionCall.id
  • functionResponse.id

Relevant file:

  • internal/translator/gemini/openai/responses/gemini_openai-responses_request.go

The equivalent /v1/chat/completions path works, so this seems isolated to the /v1/responses translation path for Gemini/Vertex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions