Installation
Add the Kuzco SDK to your iOS project using Swift Package Manager.
Requirements
- iOS 16.0 or later
- Xcode 15.0 or later
- Swift 5.9 or later
Swift Package Manager
Add Kuzco to your project using Xcode's Swift Package Manager:
- Open your project in Xcode
- Go to File → Add Package Dependencies...
- Enter the package URL:
https://github.com/kuzco-ai/kuzco-ios-sdk- Select the version rule (recommended: "Up to Next Major Version")
- Click Add Package
- Select Kuzco as the package product
Package.swift
Alternatively, add Kuzco directly to your Package.swift:
Package.swift
dependencies: [ .package(url: "https://github.com/kuzco-ai/kuzco-ios-sdk", from: "1.0.0")]API Key Setup
Initialize Kuzco with your API key at app startup. The recommended place is in your app's entry point:
MyApp.swift
import SwiftUIimport Kuzco@mainstruct MyApp: App { init() { KuzcoClient.initialize(apiKey: "kzc_your_api_key_here") } var body: some Scene { WindowGroup { ContentView() } }}API Key Format
Valid Kuzco API keys follow this format:
- Prefix:
kzc_ - Minimum length: 20 characters
- Contains alphanumeric characters and underscores
Security Note
Never commit your API key to version control. Use environment variables or a secure secrets manager for production apps.
Initialization Options
You can also configure Kuzco with additional options:
MyApp.swift
import Kuzco// Basic initializationKuzcoClient.initialize(apiKey: "kzc_your_api_key_here")// Check if initializedif KuzcoClient.shared.isInitialized { print("Kuzco is ready!")}Verify Installation
Test your installation by creating a simple session:
ContentView.swift
import SwiftUIimport Kuzcostruct ContentView: View { @State private var response = "" var body: some View { VStack { Text(response) Button("Test Kuzco") { Task { do { let session = try await KuzcoSession(model: .qwen3_4b) let result = try await session.oneShot("Say hello!") response = result.text } catch { response = "Error: \(error.localizedDescription)" } } } } }}