A reverse proxy server built with ASP.NET Core and YARP (Yet Another Reverse Proxy) that forwards requests to the Anthropic API with request/response logging capabilities.
- Reverse Proxy: Forwards all incoming requests to
https://api.anthropic.com/
- Request/Response Logging: Logs HTTP method, request content, and response content to console for debugging
- Built with YARP: Leverages Microsoft's high-performance reverse proxy library
- ASP.NET Core 8.0: Modern web framework with built-in performance optimizations
- .NET 8.0 SDK or later
- Visual Studio 2022, Rider, or VS Code (optional)
cd ccp
dotnet build
dotnet run
The proxy will start on the default ASP.NET Core ports (typically http://localhost:5000
and https://localhost:5001
).
The proxy configuration is defined in appsettings.json
:
{
"ReverseProxy": {
"Routes": {
"route1": {
"ClusterId": "cluster1",
"Match": {
"Path": "{**catch-all}"
}
}
},
"Clusters": {
"cluster1": {
"Destinations": {
"destination1": {
"Address": "https://api.anthropic.com/"
}
}
}
}
}
}
Once running, send requests to the proxy server and they will be forwarded to the Anthropic API. All requests and responses will be logged to the console for monitoring and debugging purposes.
Example:
ANTHROPIC_BASE_URL="http://localhost:2311" claude
Make sure the address matches the output of the proxy.
Program.cs
- Main application entry point with YARP configurationccp.csproj
- Project file with dependenciesappsettings.json
- Application configuration including proxy routes
- Yarp.ReverseProxy (2.3.0) - Microsoft's reverse proxy library
- Microsoft.AspNetCore.Diagnostics.Middleware (9.9.0) - Diagnostic middleware
- Microsoft.Extensions.Compliance.Redaction (9.9.0) - Data redaction capabilities
The application includes request and response transform middleware that logs:
- HTTP method and request details
- Request content (if present)
- Response details and content
This logging can be helpful for debugging API interactions and monitoring traffic flow.
See LICENSE.md