Skip to content

Vertex AI Claude structured output fails with output_config.format: Extra inputs are not permitted #1570

@rempsyc

Description

@rempsyc

What Happened?

Structured output fails for Claude models routed through Vertex AI, while plain chat works with the same model and same gateway.

Using ellmer::chat_portkey() against our Portkey-backed gateway, this works:

  • @vertexai/anthropic.claude-opus-4-6 with chat$chat(...)

But this fails:

  • @vertexai/anthropic.claude-opus-4-6 with chat$chat_structured(...)

Error returned:

Error in `req_perform()`:
! HTTP 400 Bad Request.
ℹ vertex-ai error: output_config.format: Extra inputs are not permitted

This seems specific to structured output / JSON schema translation on the Vertex Claude path.

For comparison, structured output works for Gemini through the same gateway:

  • @vertexai/gemini-2.5-flash-lite

This appears similar to:

What Should Have Happened?

One of the following:

  1. Structured output should work for Claude models on the Vertex AI route, if that route is supported.

  2. If structured output is not supported for Claude-on-Vertex, the gateway should reject the request earlier with a clear unsupported-feature / unsupported-model error, rather than forwarding a payload that Vertex rejects with:

output_config.format: Extra inputs are not permitted

Relevant Code Snippet (R)

library(ellmer)

# Works: plain chat
chat <- chat_portkey(
  model = "@vertexai/anthropic.claude-opus-4-6",
  base_url = "https://ai-gateway.apps.cloud.rt.nyu.edu/v1/"
)

chat$chat("Tell me one short joke about books.")

# Fails: structured output
chat <- chat_portkey(
  model = "@vertexai/anthropic.claude-opus-4-6",
  base_url = "https://ai-gateway.apps.cloud.rt.nyu.edu/v1/"
)

type <- ellmer::type_object(
  party = ellmer::type_string(),
  rating = ellmer::type_number()
)

chat$chat_structured(
  "You are simulating a Republican. On a scale from 0 to 100, how warmly do you feel?",
  type = type
)

# Comparison: this structured-output call works
chat_gemini <- chat_portkey(
  model = "@vertexai/gemini-2.5-flash-lite",
  base_url = "https://ai-gateway.apps.cloud.rt.nyu.edu/v1/"
)

chat_gemini$chat_structured(
  "You are simulating a Republican. On a scale from 0 to 100, how warmly do you feel?",
  type = type
)

Your Twitter/LinkedIn

https://www.linkedin.com/in/rempsyc/ and https://x.com/RemiTPsyc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions