> ## 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.

## 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.

<Tabs>
  <Tab title="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.
  </Tab>

  <Tab title="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")
            ]
        )
    ]
    ```
  </Tab>
</Tabs>

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.
</Note>

## Quick Start

<Steps>
  <Step title="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**
  </Step>

  <Step title="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.
    </Warning>
  </Step>

  <Step title="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](/docs/ios-sdk/chatbase-client#init).
  </Step>

  <Step title="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](/docs/ios-sdk/chat-response) for every field on the response.
  </Step>

  <Step title="Continue the conversation">
    ```swift theme={null}
    let followUp = try await client.send(
        "Tell me more",
        conversationId: response.conversationId
    )
    ```

    For UI code, use [`ConversationState`](/docs/ios-sdk/swiftui) instead. It keeps the conversation ID for you, along with the message list.
  </Step>
</Steps>

<Tip>
  There is no `close()` or cleanup call. The client shuts down its network session when it goes out of scope.
</Tip>

## Next Steps

<CardGroup cols={2}>
  <Card title="Streaming" icon="wave-pulse" href="/docs/ios-sdk/streaming">
    Stream replies with async/await and callbacks
  </Card>

  <Card title="SwiftUI" icon="swift" href="/docs/ios-sdk/swiftui">
    Ready-made state for chat screens
  </Card>

  <Card title="Client-Side Tools" icon="bolt" href="/docs/ios-sdk/client-side-tools">
    Let the AI agent run functions on the device
  </Card>

  <Card title="ChatbaseClient" icon="code" href="/docs/ios-sdk/chatbase-client">
    Initializer, properties, and methods
  </Card>
</CardGroup>


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