Skip to content

[Bug] Claude /v1/models listing omits documented Anthropic schema field #3833

Description

@dcrdev

Is it a request payload issue?

  • 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
N/A - this is a response-schema conformance issue, not a request payload issue.

Describe the bug
The Anthropic-compatible model listing (GET /v1/models routed to the Claude handler) returns model objects that omit fields defined by Anthropic's List Models response schema, so the response is not a faithful emulation of the upstream API.

Per the spec, each object in data[] is a ModelInfo with id, display_name, max_input_tokens (number), max_tokens (number), created_at, type, and an optional capabilities.

The Claude branch of convertModelToMap (internal/registry/model_registry.go) currently emits only id, object, owned_by, created_at, type, and display_name, and emits display_name only when it is non-empty:

  • max_input_tokens — not emitted
  • max_tokens — not emitted
  • display_name — dropped for any model without a configured display name

The registry already holds the data needed (ModelInfo.ContextLength and ModelInfo.MaxCompletionTokens), and the Gemini branch of the same function already surfaces equivalent metadata as inputTokenLimit / outputTokenLimit - so the Claude branch is simply incomplete relative to both the spec and existing in-repo precedent.

CLI Type
claude code (any Claude-backed account; the gap is in the Claude-compatible /v1/models output regardless of the underlying auth type)

Model Name
Any claude-* model (example: claude-sonnet-4-6)

LLM Client
Any client that dynamically fetches the model list and deserializes it strictly against the documented Anthropic schema. Clients that ship a hardcoded model list are unaffected, which is why this has gone unnoticed.

Request Information

curl -s http://localhost:8317/v1/models \
  -H 'User-Agent: claude-cli' \
  -H 'Anthropic-Version: 2023-06-01' \
  -H 'X-Api-Key: <key>'

Each entry in data[] comes back without max_input_tokens / max_tokens, and without display_name when the model has no configured display name.

Expected behavior
The Claude listing should include the documented fields for every model:

  • max_input_tokens sourced from ContextLength
  • max_tokens sourced from MaxCompletionTokens
  • display_name always present (falling back to the model id when unset)

with sensible defaults for the token fields when a model lacks the metadata, so the listing always carries usable, schema-valid values.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions