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

# Vercel AI SDK

> Use the Vercel AI SDK with the Halesis API.

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

```bash yarn theme={null}
yarn add ai @ai-sdk/openai-compatible
```

```bash pnpm theme={null}
pnpm add ai @ai-sdk/openai-compatible
```

```bash bun theme={null}
bun add ai @ai-sdk/openai-compatible
```

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

const halesis = createOpenAICompatible({
  name: "halesis",
  baseURL: "https://api.halesis.com/v1",
  apiKey: process.env.HALESIS_API_KEY,
});

const { text } = await generateText({
  model: halesis("b1-fast"),
  prompt: "Hello!",
});

console.log(text);
```

See the [Chat Completions API reference](https://docs.halesis.com/api-reference/chat/create-a-chat-completion.md) for supported parameters.

Set up using a coding agent

Configure this project's Vercel AI SDK to call the Halesis API.

Inspect the codebase and follow its existing AI SDK version and provider patterns. Use an OpenAI-compatible provider with base URL `https://api.halesis.com/v1`, read the API key from the server-side `HALESIS_API_KEY` environment variable, and select the Halesis model `b1-fast`. Prefer the project's existing provider package; if it does not have one, use `@ai-sdk/openai-compatible`.

Keep the API key on the server, use Chat Completions-compatible features, and do not invent a Halesis-specific SDK. Make the smallest necessary changes and run relevant checks.


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