Skip to content

Conversation

BIGPPWONG
Copy link

@BIGPPWONG BIGPPWONG commented Jul 30, 2025

Summary

  • Add Anthropic passthrough support to enable direct integration with Anthropic-compatible providers (e.g., LiteLLM)
  • Implement native Anthropic API format support with full SSE streaming capabilities
  • Maintain backward compatibility with existing OpenAI format routing

🚀 Features Added

Anthropic Passthrough Support

Native Anthropic Format: Direct passthrough of original Anthropic API requests
SSE Streaming: Full Server-Sent Events streaming support for real-time responses
Smart URL Handling: Intelligent API endpoint construction (both basic and full URLs)
Auto-detection: Automatic streaming/non-streaming response handling
Backward Compatibility: Existing configurations continue to work unchanged


Technical Implementation


📝 Configuration

Provider Configuration

Add type field to enable Anthropic passthrough:

{
  "Providers": [
    {
      "name": "anthropic-direct",
      "type": "anthropic",
      "api_base_url": "https://api.anthropic.com",
      "api_key": "your-api-key",
      "models": ["claude-3-5-sonnet-20241022"]
    }
  ]
}

URL Configuration Options

  • Basic URL: "https://api.anthropic.com" → auto-constructs to https://api.anthropic.com/v1/messages
  • Full URL: "https://your-proxy.com/v1/messages" → uses as-is

🔄 Backward Compatibility

  • Existing providers without type field default to "openai" format
  • No breaking changes to current configurations
  • Gradual migration path available

🧪 Testing

  • Configurations validated with both Anthropic official API and proxy services
  • SSE streaming tested with real-time response scenarios
  • Error handling and resource cleanup verified

📚 Documentation

  • Updated README.md and README_zh.md with comprehensive configuration guides
  • Included usage examples and troubleshooting tips

@BIGPPWONG BIGPPWONG marked this pull request as draft July 31, 2025 00:30
@BIGPPWONG BIGPPWONG marked this pull request as ready for review July 31, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant