lukasa1993/tanstack-skills-extracted/tanstack-ai-core-adapter-configuration
Claude Code and agent skill by lukasa1993/tanstack-skills-extracted
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install lukasa1993/tanstack-skills-extracted/tanstack-ai-core-adapter-configurationSKILL.md
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():
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 read`BYTEPLUS_VOICE_API_KEY` (Seed Speech,X-Api-Key). Ark keys are alsoregion-isolated — the default base URL is the ap-southeast endpoint.
@tanstack/ai-bedrock (Amazon Bedrock) branches on config.api:
bedrockText(model)orbedrockText(model, { api: 'converse' })(the default) — Bedrock's native Converse API via@aws-sdk/client-bedrock-runtime(adapter namebedrock-converse). Reaches the broad catalog: Claude, Nova, Llama, Mistral, DeepSeek, and more.bedrockText(model, { api: 'chat' })— OpenAI-compatible Chat Completions endpoint (adapter namebedrock). Open-weight models only (gpt-oss, DeepSeek V3.x, Gemma, Qwen, etc.). Does NOT reach Claude, Nova, or Llama.bedrockText(model, { api: 'responses' })— OpenAI-compatible Responses API, mantle-only (adapter namebedrock-responses). Currently gpt-oss and Gemma 4.
Use createBedrockText(model, apiKey, config?) to pass the key explicitly. Auth resolves from BEDROCK_API_KEY / AWS_BEARER_TOKEN_BEDROCK, or SigV4 via the standard AWS credential chain (no extra packages needed — handled by @aws-sdk/client-bedrock-runtime).
2. Runtime Adapter Switching
Use an adapter factory map to switch providers dynamically based on user input or configuration:
3. Configuring Reasoning / Thinking
Set reasoning/thinking with the reasoning option on chat(). It is the same on every provider, and the types take only the levels of the selected model:
4. Extending Adapters with Custom Models
Use extendAdapter() and createModel() to add custom or fine-tuned models while preserving type safety for the original models:
At runtime, extendAdapter simply passes through to the original factory. The _customModels parameter is only used for type inference.
5. Configuring Sampling
Sampling controls (temperature, token limits, nucleus sampling) are passed inside modelOptions using each provider's native key. They are not top-level fields on chat()/ai()/generate().
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/tanstack-ai-core-adapter-configuration/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/lukasa1993/tanstack-skills-extracted/tanstack-ai-core-adapter-configuration)