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

# Vercel AI SDK

Use PowerTokens models in the [Vercel AI SDK](https://ai-sdk.dev) through the OpenAI Compatible provider.

## Install

```bash theme={null}
npm i ai @ai-sdk/openai-compatible
```

## Configure

```bash theme={null}
export POWERTOKENS_API_KEY=your-api-key
```

Create a key on the [API keys page](https://www.powertokens.ai/en/api-keys?utm_source=docs\&utm_medium=docs\&utm_campaign=vercel-ai-sdk).

```ts theme={null}
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { generateText } from 'ai';

const powertokens = createOpenAICompatible({
  name: 'powertokens',
  apiKey: process.env.POWERTOKENS_API_KEY,
  baseURL: 'https://baze-api.powerbuyin.top/v1',
  includeUsage: true,
});

const { text } = await generateText({
  model: powertokens('glm-5.2'),
  prompt: 'Explain what an API gateway does in one sentence.',
});
```

* Base URL: `https://baze-api.powerbuyin.top/v1`
* Auth: `Authorization: Bearer <key>`
* Model IDs: see the [models page](https://powertokens.ai/models?utm_source=docs\&utm_medium=docs\&utm_campaign=vercel-ai-sdk) or `GET https://baze-api.powerbuyin.top/v1/models` (requires a key).


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