ai-sdk
Was er macht
Er führt die KI dazu, das AI SDK korrekt zu verwenden, indem sie die Dokumentation zu der Version prüft, die dein Projekt installiert hat. Er ist für Entwickler gedacht, die KI-Chatbots, Agenten oder Textfunktionen in TypeScript bauen.
Wann du ihn nutzt
- ✓Wenn du einen Chatbot, einen Agenten oder eine Textgenerierung mit dem AI SDK baust.
- ✓Wenn du Streaming, Werkzeugaufrufe oder strukturierte Ausgaben in eine KI-App einbauen willst.
- ✓Wenn du Fragen zu AI-SDK-Funktionen wie generateText oder streamText hast.
Link zum Skill
https://github.com/trycompai/crm/blob/release/.agents/skills/ai-sdk/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Kannst du mir helfen, in meiner App gestreamte Chat-Antworten mit dem AI SDK einzubauen?”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Die KI liest die mitgelieferte AI-SDK-Dokumentation deiner installierten Version und schreibt Code, der dazu passt, statt sich auf ihr Gedächtnis zu verlassen.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
What the AI SDK Is
The AI SDK by Vercel (the ai package on npm) is a TypeScript toolkit for building AI applications. It provides a unified API across model providers for text generation, structured output, tool calling, agents, embeddings, and framework UI integrations.
- Repository: https://github.com/vercel/ai
- Documentation: https://ai-sdk.dev/docs
Critical: Do Not Trust Your Own Memory
Whatever you remember about the AI SDK is likely outdated. The SDK changes frequently across versions - APIs are renamed, removed, and added. Your training data almost certainly contains obsolete APIs, deprecated patterns, and model IDs that no longer exist. UI hooks like useChat are among the most frequently changed APIs, so be especially careful with client code.
Never write AI SDK code from memory. Always verify every API, option, and pattern against the documentation and source code for the version that is actually installed in the project.
Use the Bundled, Version-Matched Docs
The ai package ships its full documentation and source code inside node_modules. These always match the installed version, so trust them over anything you remember.
- Ensure
aiis installed. Ifnode_modules/ai/does not exist, install only theaipackage using the project's package manager (e.g.pnpm add ai). Install provider packages (e.g.@ai-sdk/openai) and framework packages (e.g.@ai-sdk/react) later, when the task requires them. - Read and grep the bundled docs at
node_modules/ai/docs/and the source atnode_modules/ai/src/. - Provider and framework packages bundle their own docs at
node_modules/@ai-sdk/<name>/docs/. - If something isn't in the bundled docs, search https://ai-sdk.dev/docs. You can append
.mdto any docs page URL to get its markdown, and search viahttps://ai-sdk.dev/api/search-docs?q=your_query. - If you cannot find support for an answer in the docs or source, say so explicitly — do not guess.
AI Gateway: The Fastest Way to Start
The Vercel AI Gateway is the fastest way to get started with the AI SDK. It provides access to models from OpenAI, Anthropic, Google, and other providers through a single API, without installing provider packages or managing multiple API keys.
To set it up:
- Authenticate with OIDC (for Vercel deployments) or get an AI Gateway API key.
- Provide it to your app via the
AI_GATEWAY_API_KEYenvironment variable. - Reference models with
provider/modelstrings.
For exact setup, authentication, and usage, read the bundled guide and the AI Gateway docs.
Choosing a Model
Never use model IDs from memory — models are released and retired frequently. Fetch the current list before writing code that references a model. Do not truncate the list (e.g. with head) so you can find the newest models:
# All available models
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '.data[].id'
# Filter by provider (e.g. anthropic, openai, google)
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("anthropic/")) | .id] | reverse | .[]'
When multiple versions of a model exist, prefer the one with the highest version number.
Building and Consuming Agents
Use the SDK's built-in agent abstraction (such as ToolLoopAgent) rather than hand-rolling tool-calling loops. For end-to-end type safety, infer the UI message type from your agent definition when consuming it on the client (e.g. with useChat). Consuming an agent is framework-specific: check package.json to detect the stack, then follow the matching quickstart.
Look up the current agent, tool, and type-safety APIs in the bundled docs (node_modules/ai/docs/, especially the agents section) or at https://ai-sdk.dev/docs.
DevTools
AI SDK DevTools captures your AI SDK calls - requests, responses, tool calls, token usage, and multi-step runs - so you can inspect exactly what your agents do. Use it while developing to debug generations. It is a separate package and is intended for local development only.
For setup instructions, read the bundled DevTools documentation.
Keep the SDK Current
Outdated installs are the most common source of errors. Compare the installed version against the latest:
- Installed: the
versionfield innode_modules/ai/package.json. - Latest: run
npm view ai version.
If the installed version is a major version (or more) behind the latest, tell the user they are on an old release, and recomm
Häufige Fragen
Warum prüft er die installierte Version?
Das AI SDK ändert sich oft. Daher soll der Skill jede Schnittstelle gegen die Dokumentation der Version in deinem Projekt prüfen.
Welche KI-Anbieter deckt er ab?
Er deckt Anbieter wie OpenAI, Anthropic und Google ab, außerdem Streaming und Embeddings.
Installiert er Pakete selbst?
Er installiert das Paket ai, falls das Projekt es noch nicht hat, und Anbieter-Pakete nur, wenn sie gebraucht werden.
Details
Originalbeschreibung des Autors
Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useCh
repo: trycompai/crm
Beliebtheit
- GitHub-Sterne
- 12k
- Platz im Ranking
- #11507
- Lizenz
- MIT
- Aktualisiert
- 1.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
ai-elements
12kHilft deinem Agenten, KI-Chat-Oberflächen mit fertigen Komponenten für Unterhaltungen, Nachrichten, Werkzeugausgaben und Eingabefelder zu bauen.
better-accessibility
12kHilft deinem Agenten, Oberflächen mit Tastatur und Screenreadern nutzbar zu machen, mit Fokus, Beschriftungen, ARIA und Formularen.
better-auth-best-practices
12kHilft deinem Agenten, Better Auth für Anmeldung, Sitzungen, OAuth und Plugins in einer TypeScript-App einzurichten, nach den dokumentierten Schritten.
better-colors
12kHilft deinem Agenten, Farben für eine Weboberfläche umzurechnen, auszuwählen und zu prüfen, einschließlich OKLCH-Paletten, Kontrast und Dunkelmodus.
Ähnliche Skills
add-model-provider
394kLässt deinen Agenten einen neuen KI-Modellanbieter mit sicheren Befehlen an OpenClaw anbinden, API-Schlüssel nicht im Klartext speichern und einen Live-Test starten.
acp-router
394kHilft deinem Agenten, eine Aufgabe über OpenClaw an einen Coding-Assistenten wie Claude Code oder Cursor zu senden, damit die Arbeit in diesem Tool läuft.
browser-automation
394kBringt deinem Agenten bei, Webseiten Schritt für Schritt zu steuern, einschließlich Anmeldungen, Tabs und Wiederherstellung, wenn eine Seite nicht mehr reagiert.