ProxyKit LogoProxyKit Docs
Getting Started

Quick Start

Get up and running in 5 minutes

Prerequisites

  • OpenAI or Anthropic API key
  • iOS app with Xcode 15.0+
  • ProxyKit account (Sign up)

1. Add API Keys

# Dashboard → API Keys
OpenAI:    sk-...
Anthropic: sk-ant-...

2. Create App

# Dashboard → Apps → Create App
Name:      My App
Bundle ID: com.example.app
Team ID:   ABCDEF1234

Copy your App ID: app_xxxxxxxxxxxxxxxxxxxxxxxx

3. Install SDK

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/proxy-kit/ios-sdk", from: "1.0.0")
]

4. Configure

import AIProxy

@main
struct MyApp: App {
    init() {
        try? AIProxy.configure()
            .withAppId("app_YOUR_APP_ID")
            .build()
    }
}

5. Make Request

// Using OpenAI
let response = try await AIProxy.openai.chat.completions.create(
    model: "gpt-4",
    messages: [.user("Hello!")]
)

print(response.choices.first?.message.content ?? "")

// Using Anthropic
let response = try await AIProxy.anthropic.chat.completions.create(
    model: "claude-3-opus-20240229",
    messages: [.user("Hello!")]
)

Complete Example

import SwiftUI
import AIProxy

struct ContentView: View {
    @State private var response = ""
    @State private var isLoading = false
    
    var body: some View {
        VStack(spacing: 20) {
            Text(response)
                .padding()
            
            Button("Ask AI") {
                Task { await askAI() }
            }
            .disabled(isLoading)
        }
    }
    
    func askAI() async {
        isLoading = true
        
        do {
            let response = try await AIProxy.openai.chat.completions.create(
                model: "gpt-4",
                messages: [
                    .system("You are helpful"),
                    .user("What is Swift?")
                ]
            )
            
            self.response = response.choices.first?.message.content ?? ""
        } catch {
            self.response = "Error: \(error)"
        }
        
        isLoading = false
    }
}

Next Steps