claude2api  by yushangxiao

API for Claude web service conversion

created 4 months ago
382 stars

Top 75.9% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides an API service that wraps Claude's web interface, enabling programmatic access to its advanced features like image recognition, file uploads, and streaming responses. It targets developers and users who need to integrate Claude's capabilities into their applications, offering an OpenAI-compatible API for seamless integration.

How It Works

The service acts as a proxy, translating requests into the format understood by Claude's web service. It leverages session keys (e.g., sk-ant-sid01-*) to authenticate with Claude. Key features like image analysis are handled by constructing multi-modal message payloads, while long context is managed by uploading exceeding content as files. The API supports streaming for real-time outputs and offers automatic conversation management.

Quick Start & Requirements

  • Install/Run: Deploy via Docker (docker run ... or docker-compose up -d).
  • Prerequisites: Go 1.23+ (for building from source), Docker.
  • Configuration: Requires SESSIONS and APIKEY environment variables or a config.yaml file.
  • Docs: API Usage examples provided in README.

Highlighted Details

  • OpenAI-compatible API endpoint (/v1/chat/completions).
  • Supports image analysis via base64 encoded image URLs.
  • Automatic chat history management with file upload for long contexts.
  • Direct proxy option using sk-ant-sid01-* as keys.

Maintenance & Community

The project is maintained by yushangxiao. Contributions are welcome via pull requests.

Licensing & Compatibility

Licensed under the MIT License. This permissive license allows for commercial use and integration into closed-source applications.

Limitations & Caveats

Free users are limited to the claude-sonnet-4-20250514 model. The project relies on reverse-engineering Claude's web service, which could be subject to change by Anthropic, potentially breaking the API.

Health Check
Last commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
7
Star History
179 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.