Skip to content

Anthropic models on Vertex AI fail with FAILED_PRECONDITION (ChatCompletions not supported) #2469

@kitadesign

Description

@kitadesign

Summary

The Vertex AI Model Garden adapter added in #2287 routes all requests through the
OpenAI-compatible /chat/completions endpoint, but Anthropic Claude models on
Vertex AI do not support that endpoint
— only the Anthropic-native
:rawPredict / :streamRawPredict endpoints work.

As a result, publisher: anthropic on Vertex is effectively unusable today.

Reproduction

agent.yaml:

models:
  claude:
    provider: google
    model: claude-sonnet-4-6
    provider_opts:
      project: <YOUR_GCP_PROJECT>
      location: us-east5
      publisher: anthropic

agents:
  root:
    model: claude
    instruction: say hi

Prerequisites:

  • Anthropic Claude enabled on Vertex Model Garden for the project
  • roles/aiplatform.user granted to the caller
  • gcloud auth application-default login done

Run:

docker agent run agent.yaml --exec --yolo "hi"

Expected

Model responds.

Actual

❌ model failed: error receiving from stream:
HTTP 400: POST ".../endpoints/openapi/chat/completions": 400 Bad Request

With debug logging / direct curl the underlying error is:

{
  "error": {
    "code": 400,
    "message": "The deployed model does not support ChatCompletions. endpoint_id: ..., deployed_model_id: ...",
    "status": "FAILED_PRECONDITION"
  }
}

All Claude variants tested fail the same way:
claude-sonnet-4-6, claude-sonnet-4-5, claude-sonnet-4-5@20250929,
claude-opus-4-6, claude-haiku-4-5.

A direct :rawPredict call with the Anthropic body format returns 200 from the
same project/location, confirming access is configured correctly — only the
OpenAI-compat endpoint refuses Anthropic models.

Suggested fix

When provider_opts.publisher equals anthropic, route via the Anthropic-native
endpoint (:streamRawPredict + vertex-2023-10-16 body schema) instead of the
OpenAI-compat path in pkg/model/provider/vertexai/modelgarden.go. This mirrors
how the Bedrock adapter already talks to Anthropic models natively.

Environment

  • docker-agent: v1.46.0
  • OS: Linux (Cloud Workstation)
  • Region tested: us-east5 (+ us-east4, us-central1, us-west1, us-south1, europe-west1, europe-west4, asia-northeast1, asia-southeast1 — all same error)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions