ai-core/adapter-configuration
БесплатноБез исполняемых скриптовНе проверенProvider adapter selection and configuration: openaiText, anthropicText, geminiText, ollamaText, grokText, groqText, openRouterText, bedrockText…
от TanStack★ 3 396 звёзд на GitHubОб этом скилле
Adapter Configuration
Dependency: This skill builds on ai-core. Read it first for critical rules.
Before implementing: Ask the user which provider and model they want. Then fetch the latest available models from the provider's source code (check the adapter's model metadata file, e.g.
packages/ai-openai/src/model-meta.ts) or from the provider's API/docs to recommend the most current model. The model lists in this skill and its reference files may be outdated. Always verify against the source before recommending a specific model.
Setup
Create an adapter and use it with chat():
import { chat, toServerSentEventsResponse } from '@tanstack/ai'
import { openaiText } from '@tanstack/ai-openai'
export async function POST(request: Request) {
const { messages, threadId } = await request.json()
const stream = chat({
adapter: openaiText('gpt-5.2'),
messages,
threadId,
modelOptions: {
temperature: 0.7,
max_output_tokens: 1000,
},
})
return toServerSentEventsResponse(stream)
}
The adapter factory function takes the model name as a string literal and an
optional config object (API key, base URL, etc.). The model name is passed
into the factory, not into chat().
Sampling options (temperature, token limits, top_p/topP, etc.) live
inside modelOptions using each provider's native key — they are not
top-level options on chat(). See the per-provider table in
Configuring Sampling below.
Core Patterns
1. Adapter Selection
Each provider has a dedicated package with tree-shakeable adapter factories. The text adapter is the primary one for chat/completions:
| Provider | Package | Factory | Env Var |
|---|---|---|---|
| OpenAI | @tanstack/ai-openai |
openaiText |
OPENAI_API_KEY |
| Anthropic | @tanstack/ai-anthropic |
anthropicText |
ANTHROPIC_API_KEY |
| Gemini | @tanstack/ai-gemini |
geminiText |
GOOGLE_API_KEY or GEMINI_API_KEY |
| Grok (xAI) | @tanstack/ai-grok |
grokText |
XAI_API_KEY |
| Groq | @tanstack/ai-groq |
groqText |
GROQ_API_KEY |
| OpenRouter | @tanstack/ai-openrouter |
openRouterText |
OPENROUTER_API_KEY |
| Ollama | @tanstack/ai-ollama |
ollamaText |
OLLAMA_HOST (default: http://localhost:11434) |
| Bedrock | @tanstack/ai-bedrock |
bedrockText |
BEDROCK_API_KEY or AWS_BEARER_TOKEN_BEDROCK |
| BytePlus | @tanstack/ai-byteplus |
byteplusText |
ARK_API_KEY (falls back to BYTEPLUS_API_KEY) |
| OpenAI-compatible | @tanstack/ai-openai/compatible |
openaiCompatible / openaiCompatibleText |
provider-specific (passed via apiKey) |
| Cloudflare | @tanstack/ai-cloudflare |
cloudflareText |
CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN, or { binding: env.AI } in a Worker |
| Neon AI Gateway | @tanstack/ai-neon |
neonText |
NEON_AI_GATEWAY_TOKEN + NEON_AI_GATEWAY_BASE_URL (branch host) |
BytePlus uses two keys.
byteplusText/byteplusVideo/byteplusImagereadARK_API_KEY(ModelArk,Authorization: Bearer), butbyteplusSpeech/byteplusTranscriptionare a separate product and readBYTEPLUS_VOICE_API_KEY(Seed Speech,X-Api-Key). Ark keys are also region-isolated — the default base URL is the ap-southeast endpoint.
// Each factory takes model as first arg, optional config as second
import { openaiText, createOpenaiChat } from '@tanstack/ai-openai'
import { anthropicText } from '@tanstack/ai-anthropic'
import { geminiText } from
Установить ai-core/adapter-configuration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ai-core/adapter-configuration?
Provider adapter selection and configuration: openaiText, anthropicText, geminiText, ollamaText, grokText, groqText, openRouterText, bedrockText, byteplusText, openaiCompatible. Per-model type safety with modelOptions, reasoning/thinking configuration, runtime adapter switching, extendAdapter() for custom models, createModel(). Generic OpenAI-compatible providers (DeepSeek, Together, Fireworks, etc.) via openaiCompatible({ baseURL, apiKey, models }) from @tanstack/ai-openai/compatible. API key env vars: OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY/GEMINI_API_KEY, XAI_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY, OLLAMA_HOST, BEDROCK_API_KEY (or AWS_BEARER_TOKEN_BEDROCK). BytePlus needs TWO keys: ARK_API_KEY (ModelArk — chat/video/image) and BYTEPLUS_VOICE_API_KEY (Seed Speech — TTS/transcription); neither is a fallback for the other.
Как установить скилл ai-core/adapter-configuration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ai-core/adapter-configuration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic