Skip to content
All use cases

Side-project chatbotFree and cheap · Free

Build a free chatbot for a side project

Stream replies from anyrouter/free with the AI SDK. No credit deduction, and one model id that fails over between free models.

Set it up

streamText
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { streamText } from "ai"

const anyrouter = createAnyRouter()

const result = streamText({
  model: anyrouter("anyrouter/free"),
  system: "You are a friendly help bot for my project.",
  prompt: "How do I reset my password?",
})

for await (const textPart of result.textStream) {
  process.stdout.write(textPart)
}
  1. 1.Create a key and keep it on your server, never in the browser.
  2. 2.npm install @anyr/ai-sdk-provider ai, then stream with anyrouter/free.
  3. 3.Read the model field in the response or Dashboard → Logs to see which free model answered.
Why use this

A demo chatbot dies the day its one free model gets rate-limited, and a paid key on a public page is a bill waiting to happen.

Other ways to set it up
curl · anyrouter/free
curl https://anyrouter.dev/api/v1/chat/completions \
  -H "Authorization: Bearer $ANYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anyrouter/free",
    "messages": [{ "role": "user", "content": "Say hello in one sentence." }]
  }'
Endpoints and key
OpenAI-compatible
https://anyrouter.dev/api/v1
Anthropic-compatible
https://anyrouter.dev/api
Key
ANYROUTER_API_KEY (sk-ar-…)
Watch the walkthrough