Skip to content

feat(llm/claude): implement list_models_remote via GET /v1/models #994

@bug-ops

Description

@bug-ops

Parent Epic

#991

Depends On

#992

Summary

Override list_models_remote in ClaudeProvider to query the Anthropic models API.

Endpoint

GET https://api.anthropic.com/v1/models
Authorization: x-api-key: {api_key}
anthropic-version: 2023-06-01

Response Shape

{
  "data": [
    {
      "id": "claude-opus-4-6",
      "display_name": "Claude Opus 4.6",
      "created_at": "2025-08-01T00:00:00Z",
      "type": "model"
    }
  ],
  "has_more": false,
  "first_id": "...",
  "last_id": "..."
}

API supports pagination via ?after_id= query parameter.

Implementation Notes

  • Paginate until has_more == false, accumulate all pages.
  • Map data[].idModelInfo::id, data[].display_nameModelInfo::display_name,
    data[].created_atModelInfo::created_at.
  • Cache with provider slug "claude".
  • Reuse self.client (existing reqwest::Client).
  • Filter to only "type": "model" entries if other types appear.

Acceptance Criteria

  • Full pagination — all pages are fetched and merged.
  • ModelInfo populated with id, display_name, created_at.
  • Cached result served within TTL without network call.
  • Invalid/expired API key returns LlmError::Auth, does not cache.
  • Unit tests with wiremock or similar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    llmLLM provider related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions