Skip to main content

Install

These snippets are written for AI SDK 5.

Setup

Or with custom config:

Generate Text

Stream Text

Chat UI (Next.js)

API Route

Client Component

In AI SDK 5 the hook comes from @ai-sdk/react, it keeps no input state of its own, and a message’s text lives in m.parts, not m.content.
See Tool Calling and Error Handling for those topics, and the JavaScript guide for the plain OpenAI-compatible client.

Model Aliases

Use aliases instead of full model IDs:
See all aliases.

Models

Any active Kyma model in /v1/models works with the AI SDK:
A new account’s signup credit is added once your email is verified and spends on free tier models only. A model outside it returns 402 model_requires_paid until you buy credits. Check free_tier on GET /v1/models before you pin a model.