> ## Documentation Index
> Fetch the complete documentation index at: https://chatbase.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation & Quickstart

> Install the Chatbase iOS SDK and send your first message.

> [!TIP]
>
> **Want the full chat without building a UI?** Load the chat in a WebView. It's the simplest way to add your agent to an app, with the same chat, actions, forms, tickets and voice as your website. See [Mobile apps](https://chatbase.co/docs/developer-guides/website-integration/iframe.md#mobile-apps). Use the SDK when you want your own native chat UI.

## Prerequisites

| Requirement | Minimum |
| - | - |
| iOS | 17.0 |
| macOS | 14.0 |
| Swift | 6.0 |
| Xcode | 16 |
| SwiftUI | Not required. The SDK works with UIKit or any UI framework. |

## Installation

The SDK ships as a Swift Package.

**Xcode**

1. **File** → **Add Package Dependencies…**
2. Paste the repository URL:

   ```
   https://github.com/Chatbase-co/chatbase-ios-sdk.git
   ```
3. Choose version `0.1.0-beta.1` (or **Up to Next Minor**) and add the **ChatbaseSDK** library to your app target.

**Package.swift**

```swift theme={null}
// Package.swift
dependencies: [
    .package(
        url: "https://github.com/Chatbase-co/chatbase-ios-sdk.git",
        from: "0.1.0-beta.1"
    )
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "ChatbaseSDK", package: "chatbase-ios-sdk")
        ]
    )
]
```

Then import it:

```swift theme={null}
import ChatbaseSDK
```

> [!NOTE]
>
> No `Info.plist` changes are needed. The SDK talks to `https://www.chatbase.co` over HTTPS, which iOS allows by default.

## Quick Start

**1. Get your Agent ID**

1. Go to the [Chatbase Dashboard](https://www.chatbase.co/dashboard)
2. Select your AI agent
3. Go to **Settings** → **General**
4. Copy the **Agent ID**

**2. Enable the iOS SDK channel**

In the dashboard, go to **Deploy** → **iOS SDK** and enable the channel for your AI agent.

> [!WARNING]
>
> If the iOS SDK channel is not enabled, every SDK request fails with a `404` `AGENT_NOT_FOUND` error, even when the agent ID is correct.

**3. Create a client**

```swift theme={null}
import ChatbaseSDK

let client = ChatbaseClient(agentId: "YOUR_AGENT_ID")
```

Create the client once and keep it around, in a view model, an app-level dependency, or a `@State` property. A new client starts anonymous, tied to a device ID that stays the same across launches. For configuration options, see [ChatbaseClient](https://chatbase.co/docs/ios-sdk/chatbase-client.md#init).

**4. Send your first message**

```swift theme={null}
let response = try await client.send("Hello! How can you help me?") { cb in
    cb.onTextDelta = { chunk in
        // Runs for each chunk of text as it arrives
        print(chunk, terminator: "")
    }
}

print(response.message.text)
print("Conversation: \(response.conversationId)")
print("Credits used: \(response.usage.credits)")
```

See [ChatResponse](https://chatbase.co/docs/ios-sdk/chat-response.md) for every field on the response.

**5. Continue the conversation**

```swift theme={null}
let followUp = try await client.send(
    "Tell me more",
    conversationId: response.conversationId
)
```

For UI code, use [`ConversationState`](https://chatbase.co/docs/ios-sdk/swiftui) instead. It keeps the conversation ID for you, along with the message list.

> [!TIP]
>
> There is no `close()` or cleanup call. The client shuts down its network session when it goes out of scope.

## Next Steps

> **[Streaming](https://chatbase.co/docs/ios-sdk/streaming.md)**
>
> Stream replies with async/await and callbacks

> **[SwiftUI](https://chatbase.co/docs/ios-sdk/swiftui.md)**
>
> Ready-made state for chat screens

> **[Client-Side Tools](https://chatbase.co/docs/ios-sdk/client-side-tools.md)**
>
> Let the AI agent run functions on the device

> **[ChatbaseClient](https://chatbase.co/docs/ios-sdk/chatbase-client.md)**
>
> Initializer, properties, and methods


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.