Skip to content

[Claude Code] Update Proxy to passthrough Messages API #287655

@TylerLeonhardt

Description

@TylerLeonhardt

Overview

Update ClaudeLanguageModelServer to properly passthrough the Anthropic Messages API while maintaining billing behavior for user-generated messages and proper user agent handling.

Current State

The ClaudeLanguageModelServer in src/extension/agents/claude/node/claudeLanguageModelServer.ts already implements an HTTP server that provides an Anthropic Messages API compatible endpoint. It acts as a proxy to the underlying model endpoint.

Tasks

  • Review current proxy implementation in ClaudeLanguageModelServer
  • Ensure proper passthrough of Messages API requests
  • Maintain billing behavior by correctly determining user-generated messages vs. system messages
  • Ensure proper user agent is set on outgoing requests
  • Verify streaming (stream: true) works correctly
  • Verify non-streaming requests work correctly
  • Add proper logging for debugging proxy issues
  • Update tests for proxy behavior

Key Considerations

  • The proxy currently validates auth using a nonce (x-api-key)
  • Requests are handled via handleAuthedMessagesRequest
  • Need to preserve telemetry data flow through IChatMLFetcher and IEndpointProvider

Related Files

  • src/extension/agents/claude/node/claudeLanguageModelServer.ts
  • src/platform/endpoint/node/messagesApi.ts
  • src/platform/networking/common/networking.ts

Dependencies

  • Should be done after SDK update (#TBD)

Metadata

Metadata

Labels

chat-external-agentThe platform for external agent integrationdebtCode quality issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions