---
title: "Getting started with AI Assistant and Nutrient iOS SDK"
canonical_url: "https://www.nutrient.io/sdk/ai-assistant/getting-started/ios/"
md_url: "https://www.nutrient.io/sdk/ai-assistant/getting-started/ios.md"
last_updated: "2026-05-30T02:20:01.489Z"
description: "Integrate AI Assistant with Nutrient iOS SDK for powerful document processing. Enable document querying, summarizing, and translation in your applications."
---

# Getting started with AI Assistant and Nutrient iOS SDK

AI Assistant provides [Nutrient iOS SDK](https://www.nutrient.io/guides/ios.md) with AI functionality. Using intelligent document processing (IDP) technology, AI Assistant enables users to query, summarize, translate, compare document text on the fly.

**View example**

Prefer to jump straight into code? View the example repo on GitHub.

[Read more](https://github.com/PSPDFKit/ai-assistant-demo)

To set up a fully functional AI system, you’ll need a Docker container service and a library working in unison:

- [Nutrient iOS SDK](https://www.nutrient.io/guides/ios.md) — A document viewer for iOS that also exposes a user interface (UI) for the AI features.

- AI Assistant — A service to process the AI requests and process documents.

## Prerequisites

AI Assistant is distributed as a Docker container. To run it on your computer, you need to install a Docker runtime distribution for your operating system.

### macOS

Install and start Docker Desktop for Mac. Refer to the [Docker website](https://docs.docker.com/docker-for-mac/install/) for instructions.

### Windows

Install and start Docker Desktop for Windows. Refer to the [Docker website](https://docs.docker.com/docker-for-windows/install/) for instructions.

### Linux

Install and start Docker Engine. Refer to the [Docker website](https://docs.docker.com/engine/install/#server) for instructions on how to install it for your Linux distribution.

After you install Docker, use [these instructions](https://docs.docker.com/compose/install/#install-compose-on-linux-systems) to install Docker Compose.

## Obtaining an OpenAI API key

AI Assistant requires an API key from either of these LLM providers:

- OpenAI

- Azure OpenAI

This example will use OpenAI, but if you want to use Azure OpenAI, refer to the [Azure OpenAI guide](https://www.nutrient.io/guides/ai-assistant/service-configuration/model-providers/azure-provider.md).

If you don’t have an OpenAI key, create one by following the steps in the next section. Otherwise, skip to the [Setting up AI Assistant](#setting-up-ai-assistant) section.

### Creating an OpenAI account

To create an OpenAI account, [sign up](https://platform.openai.com/signup) to obtain an [API key](https://platform.openai.com/account/api-keys).

> The OpenAI API has attained **SOC 2 Type 2** compliance (see the [official announcement](https://trust.openai.com/?tcuUid=16a1f4e1-9120-45c1-96bd-5c1007f0f3d1)).

Save your API key somewhere safe, as you’ll need it in the [Setting up AI Assistant](#setting-up-ai-assistant) section.

## Setting up AI Assistant

AI Assistant requires a PostgreSQL database with the [pgvector](https://github.com/pgvector/pgvector) extension to operate.

Copy the code snippet below and save it anywhere on your computer in a file called `docker-compose.yml`. Replace the `<your-openai-api-key>` placeholder with your OpenAI API key:

```yaml

version: "3.8"

services:
  ai-assistant:
    image: pspdfkit/ai-assistant:nightly
    environment:
      OPENAI_API_KEY: <your-openai-api-key>
      PGUSER: db-user
      PGPASSWORD: password
      PGDATABASE: ai_assistant
      PGHOST: db
      PGPORT: 5432
      API_AUTH_TOKEN: secret
      JWT_PUBLIC_KEY: |
        -----BEGIN PUBLIC KEY-----
        MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2gzhmJ9TDanEzWdP1WG+
        0Ecwbe7f3bv6e5UUpvcT5q68IQJKP47AQdBAnSlFVi4X9SaurbWoXdS6jpmPpk24
        QvitzLNFphHdwjFBelTAOa6taZrSusoFvrtK9x5xsW4zzt/bkpUraNx82Z8MwLwr
        t6HlY7dgO9+xBAabj4t1d2t+0HS8O/ed3CB6T2lj6S8AbLDSEFc9ScO6Uc1XJlSo
        rgyJJSPCpNhSq3AubEZ1wMS1iEtgAzTPRDsQv50qWIbn634HLWxTP/UH6YNJBwzt
        3O6q29kTtjXlMGXCvin37PyX4Jy1IiPFwJm45aWJGKSfVGMDojTJbuUtM+8P9Rrn
        AwIDAQAB
        -----END PUBLIC KEY-----
      JWT_ALGORITHM: RS256
      DASHBOARD_USERNAME: dashboard
      DASHBOARD_PASSWORD: secret
      SECRET_KEY_BASE: secret-key-base
    ports:
      - 4000:4000
    depends_on:
      db:
        condition: service_healthy
  db:
    image: pgvector/pgvector:pg16
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U db-user -d ai_assistant" ]
      interval: 3s
      timeout: 3s
      retries: 10
    environment:
      POSTGRES_USER: db-user
      POSTGRES_PASSWORD: password
      POSTGRES_DB: ai_assistant
      POSTGRES_INITDB_ARGS: --data-checksums
      PGDATA: /var/lib/postgresql/data/pgdata
    volumes:
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata:

```

## Starting AI Assistant

Now open a terminal emulator.

### macOS

Use the terminal emulator integrated with your code editor or IDE. Alternatively, you can use `Terminal.app` or [iTerm2](https://iterm2.com/).

### Windows

Use your code editor’s integrated terminal or [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-windows-powershell?view=powershell-7.5).

### Linux

Use the terminal emulator integrated with your code editor or IDE, or one bundled with your desktop environment.

Go to the directory where you saved the `docker-compose.yml` file:

```sh

cd <path-to-directory-with-docker-compose-yml>

```

Run the following:

```sh

docker-compose up

```

This command might take a while to run, depending on your internet connection speed. Wait until you see the following message in the terminal:

```

ai_document_assistant  | info: AI Assistant started

```

AI Assistant is now up and running!

## Setting up AI Assistant on iOS

To get started, either implement AI Assistant in your own app by following the steps below, or check out [`AIAssistantExample`](https://github.com/PSPDFKit/pspdfkit-ios-catalog/blob/master/Catalog/Examples/Top/AIAssistantExample/AIAssistantExample.swift) in our [Catalog app](https://github.com/PSPDFKit/pspdfkit-ios-catalog). In the case of the latter, you don’t need to follow the steps below.

1. Set an [`AIAssistantConfiguration`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfconfigurationbuilder/aiassistantconfiguration) in your main [`PDFConfiguration`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfconfiguration). This configuration specifies the URL where your AI Assistant server can be accessed, a JSON Web Token (JWT) for authentication, a session identifier, and an optional user identifier. It’s best practice for the JWT to be generated by your own server; for more details, refer to [generate a JWT](https://www.nutrient.io/guides/ai-assistant/viewer-integration/client-authentication/generate-a-jwt.md) in our AI Assistant server guides. You may have one session for each document if you want to restore the chat history each time. You could have multiple sessions per document if multiple users access the same document in your app on one device.

2. Add [`AIAssistantButton`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/aiassistantbutton) (SwiftUI) or [`aiAssistantButtonItem`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfviewcontroller/aiassistantbuttonitem) (UIKit) to your navigation bar or toolbar. When users tap this button, the document data will be uploaded to AI Assistant on your server, and the chat UI will be presented.
---

## Related pages

- [Getting started with AI Assistant](/sdk/ai-assistant/getting-started.md)
- [Getting started with AI Assistant and Nutrient Android SDK](/sdk/ai-assistant/getting-started/android.md)
- [Getting started with AI Assistant and Nutrient Web SDK + Document Engine](/sdk/ai-assistant/getting-started/document-engine.md)
- [Getting started with AI Assistant and Nutrient Web SDK](/sdk/ai-assistant/getting-started/web.md)

