xAIKit

Swift SDK for xAI's Powerful Language Models

Why xAIKit?

🚀 Modern Swift

Built with Swift's latest features including async/await, structured concurrency, and type-safe APIs for the best developer experience.

⚡ Real-time Streaming

Support for streaming responses enables you to build interactive experiences with real-time AI feedback.

🛡️ Type-Safe

Leverage Swift's powerful type system to catch errors at compile time and write more reliable code.

📱 Cross-Platform

Works seamlessly across all Apple platforms - iOS, macOS, tvOS, watchOS, and visionOS.

🤖 Grok Models

Access xAI's advanced Grok models with their powerful reasoning and conversation capabilities.

📚 Well Documented

Comprehensive documentation and interactive tutorials help you get started quickly and efficiently.

Build for Every Apple Platform

📱 💻 📺 🥽 🐧

iOS 16+ • macOS 13+ • tvOS 16+ • watchOS 9+ • visionOS 1+ • Linux

Simple & Powerful

import xAIKit

// Initialize the client
let client = xAIClient(apiKey: "your-api-key")

// Create a chat completion
let response = try await client.chat.completions(
    messages: [
        ChatMessage(role: .user, content: "Explain quantum computing")
    ],
    model: "grok-3-mini-fast-latest"
)

// Print the response
print(response.choices.first?.message.content ?? "")