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

# Vercel AI SDK

> Learn how to use Vercel AI SDK with ScitiX Model Inference to build TypeScript AI applications with an OpenAI-compatible provider.

[Vercel AI SDK](https://github.com/vercel/ai) is the TypeScript toolkit for building AI apps. Its `@ai-sdk/openai-compatible` provider connects to any OpenAI-compatible endpoint, so it runs on the ScitiX Model Inference API.

Default model here is `glm-5.2`; see the [Models](https://console.scitix.ai/model-inference/models) page for the full list and pricing.

## Configure

Create an API key on the ScitiX [API Keys](https://console.scitix.ai/model-inference/api_keys) page and export it:

```bash theme={null}
export SCITIX_API_KEY="<Your API Key>"
```

Install `ai` and `@ai-sdk/openai-compatible`, then create a ScitiX provider:

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

const scitix = createOpenAICompatible({
  name: 'scitix',
  baseURL: 'https://api.scitix.ai/model-api/v1',
  apiKey: process.env.SCITIX_API_KEY,
});
```

| Field            | Description                                                                                                        |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ |
| `baseURL`        | ScitiX OpenAI-compatible endpoint: `https://api.scitix.ai/model-api/v1`. The provider appends `/chat/completions`. |
| `apiKey`         | Your ScitiX API key, read from the environment                                                                     |
| `scitix('<id>')` | ScitiX model ID, e.g. `scitix('glm-5.2')`                                                                          |

Use `@ai-sdk/openai-compatible`, not `@ai-sdk/openai`. The latter targets OpenAI's own API and defaults to the Responses API; the compatible provider is built for custom OpenAI-style endpoints like ScitiX.

Choose a model with native tool calling for the SDK's tool-calling / `streamText` tool features.

## Verify

Generate text — a normal reply confirms the connection (verified on **ai 7.0.62**, `@ai-sdk/openai-compatible` 3.0.30):

```ts theme={null}
const { text } = await generateText({
  model: scitix('glm-5.2'),
  prompt: 'In one short sentence, which model are you?',
});
console.log(text);
// → I'm GLM, a large language model developed by Z.ai.
```
