AIProxySwift  by lzell

Swift SDK for AI provider APIs, with optional key protection

created 1 year ago
301 stars

Top 89.6% on sourcepulse

GitHubView on GitHub
Project Summary

This Swift library provides clients for interacting with various AI providers, including OpenAI, Gemini, Anthropic, and others. It aims to simplify AI API integration into iOS and macOS applications, offering a unified interface for making requests. The library supports both direct API calls and proxied requests through a secure backend for API key protection.

How It Works

The library abstracts the complexities of different AI provider APIs into a consistent Swift interface. Users can choose to initialize services directly with their own API keys (BYOK) or use a proxied approach. The proxied approach leverages a backend service that enhances security by implementing certificate pinning, DeviceCheck verification, split key encryption, and per-user/per-IP rate limiting, protecting API keys and managing costs.

Quick Start & Requirements

  • Installation: Add the package via Xcode's Package Dependencies by entering github.com/lzell/aiproxyswift.
  • Configuration: Call AIProxy.configure() during app launch.
  • Dependencies: Requires Xcode and Swift. Specific AI provider models may have their own requirements.
  • Documentation: See AIProxy integration video and AIProxyIdentifier.swift for details.

Highlighted Details

  • Supports a wide range of AI providers: OpenAI, Gemini, Anthropic, Stability AI, DeepL, Together AI, Replicate, ElevenLabs, Fal, Groq, Perplexity, Mistral, EachAI, OpenRouter, DeepSeek, Fireworks AI, Brave.
  • Offers robust API key security through a proxied backend with multiple layers of protection.
  • Provides extensive examples for various AI provider features, including chat completions, streaming, image generation, transcription, tool use, and multimodal inputs.
  • Includes advanced settings for custom client IDs and detailed error handling for Foundation network errors.

Maintenance & Community

The project is actively maintained, with contributions welcomed. Details on contributing and community channels are available in the README.

Licensing & Compatibility

The library is released under the MIT license, allowing for commercial use and integration with closed-source applications.

Limitations & Caveats

The README mentions that some advanced features, like specific Replicate model interactions or tool calls with Llama/TogetherAI, might require further development or have specific limitations. Users should consult the detailed examples for each provider for precise usage and potential caveats.

Health Check
Last commit

2 days ago

Responsiveness

1 day

Pull Requests (30d)
14
Issues (30d)
5
Star History
79 stars in the last 90 days

Explore Similar Projects

Starred by Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers) and Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera).

client-python by mistralai

0.3%
628
Python SDK for Mistral AI platform
created 1 year ago
updated 1 week ago
Feedback? Help us improve.