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:

  1. Open your project in Xcode
  2. Go to File → Add Package Dependencies...
  3. Enter the package URL:
https://github.com/kuzco-ai/kuzco-ios-sdk
  1. Select the version rule (recommended: "Up to Next Major Version")
  2. Click Add Package
  3. 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 SwiftUI
import Kuzco
@main
struct 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 initialization
KuzcoClient.initialize(apiKey: "kzc_your_api_key_here")
// Check if initialized
if KuzcoClient.shared.isInitialized {
print("Kuzco is ready!")
}

Verify Installation

Test your installation by creating a simple session:

ContentView.swift
import SwiftUI
import Kuzco
struct 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)"
}
}
}
}
}
}