Skip to content
Live demo

AI Providers

Spark AI, SparkFeed’s built-in chat that lets you ask questions about your feeds, is powered by the Vercel AI SDK. You choose which AI provider to use by setting the appropriate API key. No code changes required.

SparkFeed checks for API keys in this order and uses the first one found:

OPENAI_API_KEY → AI_GATEWAY_API_KEY → OPENROUTER_API_KEY

Set exactly one key (or multiple, in which case the first match wins). If no key is set, the AI chat panel is disabled at runtime.

Best for most users. Straightforward, well-documented, and the default small/large model pairing is cost-efficient.

# .env.local
OPENAI_API_KEY=sk-...

Get a key at platform.openai.com/api-keys.

Default models used:

  • Small (fast, cheap): gpt-4o-mini
  • Large (high-quality): gpt-4o
Recommended for Vercel users

The Vercel AI Gateway is a unified proxy that gives you access to multiple model providers through a single API key, with built-in usage tracking.

# .env.local
AI_GATEWAY_API_KEY=...

Get a key in your Vercel dashboard → AI → Gateway.

Default models used:

  • Small: openai/gpt-4o-mini
  • Large: openai/gpt-4o

Access 200+ models from a single API key, including Claude, Gemini, DeepSeek, Llama, and more.

# .env.local
OPENROUTER_API_KEY=sk-or-...

Get a key at openrouter.ai/keys.

Default models used:

  • Small: openai/gpt-4o-mini
  • Large: openai/gpt-4o

Set AI_MODEL to any model ID supported by your chosen provider:

# .env.local
OPENAI_API_KEY=sk-...
AI_MODEL=gpt-4o # override: use large model by default
AI_GATEWAY_API_KEY=...
AI_MODEL=anthropic/claude-3-5-haiku # Claude via gateway
OPENROUTER_API_KEY=sk-or-...
AI_MODEL=deepseek/deepseek-chat-v3 # DeepSeek via OpenRouter

The full model registry is at src/config/ai-models.json. Supported providers and their included models:

Model IDTierContext
gpt-4o-miniSmall128k
gpt-4oLarge128k
Model IDTierContext
anthropic/claude-3-5-haiku-20241022Small200k
anthropic/claude-3-7-sonnet-20250219Large200k
Model IDTierContext
deepseek/deepseek-chat-v3Small64k
deepseek/deepseek-r1Large64k
Model IDTierContext
minimax/minimax-01Small1M
moonshotai/kimi-k2Large128k

When you send a message in the Spark AI panel:

  1. The client sends the message + your workspaceId to /api/ai
  2. The server queries your articles for context (latest articles from your feeds)
  3. The message + article context is streamed to the selected model
  4. The response streams back to the UI with source citations

The AI only has access to articles stored in your database. It does not fetch the internet on your behalf.

If no AI key is configured, the Spark AI panel remains visible but chat is disabled at the API level. Set any key from the options above to activate it.