Skip to main content

Choose Your Platform

Select your development platform to get started:

1. Install the SDK

Add RunAnywhere to your project using Swift Package Manager:
Package.swift
dependencies: [
    .package(url: "https://github.com/RunanywhereAI/runanywhere-sdks.git", from: "0.1.0")
]
Add the products you need:
.target(
    name: "YourApp",
    dependencies: [
        .product(name: "RunAnywhere", package: "runanywhere-swift"),
        .product(name: "RunAnywhereLlamaCPP", package: "runanywhere-swift"),
        .product(name: "RunAnywhereONNX", package: "runanywhere-swift"),
    ]
)

2. Initialize the SDK

import RunAnywhere
import LlamaCPPRuntime

@main
struct MyApp: App {
    init() {
        do {
            try RunAnywhere.initialize(
                apiKey: "your-api-key",
                baseURL: "https://api.runanywhere.ai",
                environment: .production
            )

            Task { @MainActor in
                ModuleRegistry.shared.register(LlamaCPP.self)
            }
        } catch {
            print("SDK init failed: \(error)")
        }
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

3. Generate Text

let response = try await llm.chat(
    prompt: "Hello, how can you help me today?",
    options: .init(maxTokens: 256, temperature: 0.7)
)
print(response.text)

Full Swift Documentation

Explore all Swift SDK features →

Next Steps

Need help? Check out the SDK Overview to compare all platforms, or dive into the full documentation for your chosen SDK.