@kyma-api/ai-sdk
Kyma API provider for the Vercel AI SDK. Access 16 open-source LLMs through one endpoint with automatic failover.
Install
npm install @kyma-api/ai-sdk @ai-sdk/openai-compatible
Setup
Get your API key at kymaapi.com (free $0.50 credit).
export KYMA_API_KEY="ky-your-api-key"
Usage
import { kyma } from "@kyma-api/ai-sdk";
import { generateText, streamText } from "ai";
const { text } = await generateText({
model: kyma("best"),
prompt: "What is quantum computing?",
});
const result = streamText({
model: kyma("code"),
prompt: "Write a React hook for dark mode",
});
const { text: analysis } = await generateText({
model: kyma("deepseek-r1"),
prompt: "Analyze this algorithm's time complexity...",
});
Model Aliases
Use aliases instead of memorizing model IDs:
best | Highest quality overall |
fast | Fastest response |
code | Code generation |
cheap | Lowest cost |
reasoning | Complex reasoning |
agent | Agentic tool use |
vision | Image input |
long-context | 1M token context |
balanced | Quality + speed balance |
Custom Configuration
import { createKyma } from "@kyma-api/ai-sdk";
const kyma = createKyma({
apiKey: "ky-your-api-key",
baseURL: "https://kymaapi.com/v1",
});
Links