Skip to content

secondsky/claude-skills / plugins/tanstack-ai/skills/tanstack-ai

tanstack-ai

Verified

TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama. Use for chat APIs, React/Solid frontends with useChat/ChatClient, isomorphic tools, tool approval flows, agent loops, multimodal inputs, or troubleshooting streaming and tool definitions.

references/adapter-matrix.md

View on GitHub
# TanStack AI Adapter Matrix (OpenAI | Anthropic | Gemini | Ollama)

## Env Keys
- OpenAI: `OPENAI_API_KEY`
- Anthropic: `ANTHROPIC_API_KEY`
- Gemini: `GEMINI_API_KEY`
- Ollama: `OLLAMA_HOST` (defaults to `http://localhost:11434`)

## Supported Models & Notes (alpha SDK)
| Provider | Text models | Multimodal | Streaming | Notes |
|----------|-------------|------------|-----------|-------|
| OpenAI | gpt-4o, gpt-4o-mini, gpt-3.5-turbo, etc. | Vision in 4o/4o-mini | Yes (SSE/chunk) | Use `model: 'gpt-4o'` for tools + vision |
| Anthropic | claude-3-5-sonnet, claude-3-opus, claude-3-haiku | Vision in 3.x | Yes | Tool calling supported; respect `max_output_tokens` |
| Gemini | gemini-1.5-pro/flash | Vision/audio | Yes | Requires `project` in key scope; observe safety settings |
| Ollama | local model names (e.g., llama3, mistral) | Model-dependent | Yes | Ensure `keep_alive` small for dev to free RAM |

## Per-Model Option Gotchas
- OpenAI: `response_format` only on some models; vision requires image parts.  
- Anthropic: `max_output_tokens` required; `temperature` + `top_p` interplay—set one.  
- Gemini: Enable `generationConfig` for safety; set `tools` under `systemInstruction` semantics when needed.  
- Ollama: Options vary by model; avoid sending provider-specific fields from other adapters.

## Adapter Usage Snippets
```ts
import { openai } from '@tanstack/ai-openai'
import { anthropic } from '@tanstack/ai-anthropic'
import { gemini } from '@tanstack/ai-gemini'
import { ollama } from '@tanstack/ai-ollama'

const provider = openai({ apiKey: process.env.OPENAI_API_KEY })
// swap anthropic(), gemini(), or ollama({ baseUrl: process.env.OLLAMA_HOST })
```

## Capability Checklist
- Tools: OpenAI ✅ | Anthropic ✅ | Gemini ✅ | Ollama ⚠️ (model-dependent)
- Multimodal: OpenAI vision ✅ | Anthropic vision ✅ | Gemini ✅ | Ollama ⚠️
- Streaming: All four via adapter helpers
- Native JSON mode: OpenAI & Gemini support; Anthropic via tool outputs; Ollama depends on model

## Switching Providers Safely
1. Keep tool definitions provider-agnostic; avoid provider-specific enum values.  
2. Gate model-specific options with TypeScript narrowing (e.g., helper `isOpenAIAdapter`).  
3. Verify env key exists before instantiating adapter; fail fast with HTTP 400.  
4. Run smoke test per provider: send `messages: [{ role: 'user', content: 'ping' }]` and ensure stream arrives.
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall