Documentation

Everything you need to integrate Swiftly AIKit into your apps.

Overview

Swiftly AIKit provides a unified API gateway for 8 AI providers. Use a single API key and consistent interface regardless of the underlying provider.

Key Features

  • 8 AI Providers — OpenAI, Anthropic, Google, xAI Grok, Perplexity, Cohere, Mistral, DeepSeek
  • Managed Billing — Usage tracking, quotas, and Stripe integration
  • Enterprise Security — IP allowlisting, CORS, API key hashing, rate limiting

Installation

Add SwiftlyAIClient to your Swift Package Manager dependencies:

// Package.swift
dependencies: [
    .package(url: "https://github.com/user/SwiftlyAIClient.git", from: "1.0.0")
]

Add the Swiftly AIKit SDK to your build.gradle:

implementation("dev.swiftlyai:sdk:1.0.0")

Add swiftly_ai to your pubspec.yaml:

dependencies:
  swiftly_ai: ^1.0.0

Install the React Native SDK:

npm install @swiftlyai/react-native

Install the JavaScript SDK:

npm install @swiftlyai/sdk

No installation needed. Use any HTTP client to call the REST API directly.

Base URL: https://api.swiftlyai.dev

Download the OpenAPI specification to generate clients in any language.

curl -O https://api.swiftlyai.dev/openapi.yaml

Quick Start

import SwiftlyAIClient

let client = SwiftlyAIClient(apiKey: "sa_xxx")

// Chat completion
let response = try await client.chat(
    model: "claude-sonnet-4-5",
    messages: [.user("Hello!")]
)
print(response.content)

// Streaming
for try await chunk in client.streamChat(
    model: "gpt-4o",
    messages: [.user("Tell me a story")]
) {
    print(chunk.content, terminator: "")
}
curl -X POST https://api.swiftlyai.dev/v1/ai/chat \
  -H "X-API-Key: sa_xxx" \
  -H "X-Bundle-Id: com.example.app" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Supported Providers

OpenAI

GPT models

Anthropic

Claude models

Google AI

Gemini models

xAI Grok

Grok models

Perplexity

Search-augmented AI

Cohere

Command models

Mistral AI

Mistral models

DeepSeek

DeepSeek models

API Endpoints

Method Endpoint Description
POST/v1/ai/chatChat completion
POST/v1/ai/streamSSE streaming
POST/v1/ai/imagesImage generation
POST/v1/ai/tokensToken counting
GET/v1/ai/modelsAvailable models
GET/v1/ai/usageCurrent usage

Authentication

API Key + Bundle ID

Required for all AI endpoints. Obtain your API key from the admin dashboard.

X-API-Key: sa_live_... X-Bundle-Id: com.example.myapp