SwiftAnthropic  by jamesrochabrun

Swift SDK for Anthropic API integration

Created 2 years ago
253 stars

Top 99.6% on SourcePulse

GitHubView on GitHub
Project Summary

SwiftAnthropic is an open-source Swift package designed for seamless integration with Anthropic's public API. It empowers developers on Apple platforms and Linux to leverage advanced AI models like Claude within their applications, offering a streamlined interface for complex natural language processing tasks.

How It Works

This project provides a native Swift implementation of Anthropic's API, accessible via Swift Package Manager. It abstracts common API endpoints, including text completion and the more advanced Messages API, into idiomatic Swift structures and functions. For Linux compatibility, it employs AsyncHTTPClient to circumvent known URLSession issues, ensuring robust server-side operation.

Quick Start & Requirements

  • Installation: Integrate via Swift Package Manager in Xcode (File -> Add Package Dependency, enter repository URL).
  • Prerequisites:
    • Apple Platforms: iOS 15+, macOS 12+.
    • Linux: Swift environment.
    • Anthropic API Key: Required for authentication.
    • AIProxy (Optional, for iOS apps): Requires specific configuration including aiproxyPartialKey, aiproxyServiceURL, and an environment variable (AIPROXY_DEVICE_CHECK_BYPASS) for simulator development.
  • Documentation: Refer to the project's README for detailed usage examples.

Highlighted Details

  • Comprehensive API Coverage: Supports Text Completion, Messages API (streaming and non-streaming), Function Calling, Vision (image analysis), PDF analysis, and Citations.
  • Advanced Features: Includes beta support for Prompt Caching, Extended Thinking (for enhanced reasoning), and a robust Skills API for custom tool integration.
  • Tooling: Integrates Anthropic-defined tools like Text Editor and Web Search, enabling Claude to interact with files and real-time web content.
  • AIProxy Integration: Facilitates secure API key management for iOS applications, protecting keys from client-side exposure.
  • Platform Support: Works across macOS, iOS, and Linux environments.

Maintenance & Community

Contributions are welcomed via pull requests targeting the main branch, with an emphasis on unit tests to ensure code quality and stability.

Licensing & Compatibility

  • License: The repository's license is not explicitly stated in the provided README.
  • Compatibility: Designed for Swift projects on Apple platforms (iOS, macOS) and Linux. AIProxy integration is specific to iOS applications.

Limitations & Caveats

AIProxy support is exclusively available on Apple platforms. Several advanced features, including Prompt Caching, Extended Thinking, and the Skills API, are noted as being in beta. The absence of a specified open-source license presents a significant adoption blocker, requiring clarification before commercial or widespread use.

Health Check
Last Commit

5 months ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
1 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.