Claude Proxy

A simple proxy server for the Anthropic Claude API

Usage

Send requests to any path on this server, and they will be proxied to the Anthropic API.

Examples:

  • POST /v1/messageshttps://api.anthropic.com/v1/messages
  • GET /v1/modelshttps://api.anthropic.com/v1/models
  • POST /v1/messages/streamhttps://api.anthropic.com/v1/messages/stream

Required Headers:

  • x-api-key: Your Anthropic API key
  • Content-Type: application/json: For POST requests
  • anthropic-version: API version (optional, defaults to 2023-06-01)

Example cURL:

curl -X POST https://your-domain.com/v1/messages \
  -H "x-api-key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-sonnet-20240229",
    "max_tokens": 1000,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Development Changelog Timeline

🚀

Initial Setup

Project foundation and basic configuration

🌍

1. Vercel Edge Proxy Setup

Configure Vercel edge regions globally

🔄

2. Root Path Proxy Implementation

Implement [[...path]] dynamic routing

Add comprehensive path forwarding

Complete transparent proxy functionality

🛡️

3. Fix "filter" undefined error

Implement transparent proxy

📋

Preserve request/response headers

Skip problematic headers filtering

⏱️

4. Fix 504 Timeout Issues

Add adaptive timeout handling

🔄

Implement retry with backoff

Add request performance monitoring

Production Ready

Final deployment and optimization

Key Improvements:

🌍 Global Edge Deployment

Leveraged Vercel's edge regions for optimal global performance and reduced latency.

🔄 Complete Proxy Transparency

Implemented root path proxy with dynamic routing for seamless Claude API integration.

🛡️ Error Handling

Fixed undefined filter errors through proper header handling and request preservation.

⚡ Performance Optimization

Added adaptive timeouts, retry mechanisms, and performance monitoring for reliability.