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

# Integrate Voker with the Vercel AI SDK

## Installation

Make sure the AI SDK is installed:

<CodeGroup>
  ```bash npm theme={null}
  npm install ai
  ```

  ```bash pnpm theme={null}
  pnpm add ai
  ```

  ```bash bun theme={null}
  bun add ai
  ```

  ```bash yarn theme={null}
  yarn add ai
  ```
</CodeGroup>

Make sure the Voker Typescript SDK is [installed](/sdks/typescript#installation).

<Note>the SDK does not currently support Audio, Video or Image modalities.</Note>

## Generate Text

```ts theme={null}
import { generateText } from 'ai'; // [!code --]
import * as ai from 'ai'; // [!code ++]
import { wrapAiSdk } from '@voker/voker/ai/provider-aisdk'; // [!code ++]

const { generateText } = wrapAiSdk(ai); // [!code ++]

await generateText({
    vokerAgent: 'customer-support-agent', // required // [!code ++]
    vokerSession: 'user-session-1', // required // [!code ++]
    model: 'anthropic/claude-sonnet-4.5',
    prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
```

## Stream Text

The AI SDK does not automatically record streamed steps. After streaming completes, send the generated steps using the base event creation API.

```ts theme={null}
import * as ai from 'ai';
import { VokerClient } from '@voker/voker';

const { streamText } = ai;

const vokerClient = new VokerClient();

const s = streamText({
    /* Existing streamText call */
});

s.steps.then((steps) => {
    steps.forEach((step) => {
        vokerClient.events.create({
            vokerAgent: 'AGENT_NAME',
            vokerSession: 'SESSION_ID',
            eventName: 'llm',
            properties: {
                api: 'aisdk',
                inputs: {
                    model: step.model,
                    request: step.request,
                },
                output: {
                    usage: step.usage,
                    response: step.response,
                },
            },
        });
    });
});
```

## Next steps

* [TypeScript SDK reference](/sdks/typescript) - installation, configuration, and type definitions.
