@kyma-api/ai-sdk
v0.2.0
Published
Kyma API provider for the Vercel AI SDK. 16 open-source LLMs, one endpoint, auto-failover.
Maintainers
Readme
@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-compatibleSetup
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";
// Use model aliases
const { text } = await generateText({
model: kyma("best"),
prompt: "What is quantum computing?",
});
// Stream responses
const result = streamText({
model: kyma("code"),
prompt: "Write a React hook for dark mode",
});
// Use specific models
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:
| Alias | Best For |
|-------|----------|
| 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", // default
});