Skip to content

[Claude Code - Tracking] Integration via Anthropic Messages API #113

Description

@ashwing

Overview

Support Claude Code as a client of agentic-api, the way Codex is supported today. Claude Code speaks the Anthropic Messages API (/v1/messages), not Responses — so this is a new surface, but a stateless one: Claude Code sends the full conversation every turn, so the gateway holds no state (no storage, no rehydration, no persistence). Design doc and live-spike results: #98. Executes ROADMAP §4 Messages API.

What the gateway must implement

  1. Transparent /v1/messages + /v1/messages/count_tokens proxy to vLLM.
  2. The Anthropic gateway protocol contract (forward anthropic-* headers + error bodies unchanged, preserve the system attribution block, accept either auth header).
  3. A server-side tool loop that executes gateway-owned tools (web_search, MCP) without exposing them to the client, mapping Anthropic tool_use/tool_result to the shared tool framework.

No storage layer. No previous_response_id analog. No stored-response object.

Spike findings (already settled, see #98)

Verified live against the real Claude Code CLI (2.1.208) + vLLM 0.25.1:

  • Gateway-owned tools only work server-side. Claude Code executes every tool_use against its own local registry and errors No such tool available on anything it didn't declare — it never waits for the gateway to supply a tool_result. Advertising a gateway tool to the client cannot work; the gateway must run the loop itself and surface only the final message.
  • vLLM 0.25.1 accepts every advanced field Claude Code sends (thinking adaptive/enabled, output_config, context_management, metadata) at HTTP 200, alone and combined — no field-level 400 hazard. Only real constraint is context-window sizing.

Stages

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions