ID cố định sẽ hỏng
Nếu code ghim google/gemini-3.5-flash, bạn phải sửa mỗi khi có bản Flash mới hơn, và nó sẽ hỏng ngay ngày model đó bị gỡ hoặc gặp sự cố.
Alias latest gọi tên một họ model. Gửi google/gemini-flash-latest và AnyRouter sẽ gọi model Gemini Flash mới nhất có thể xử lý yêu cầu của bạn ngay lúc đó. Nếu nó không khả dụng, AnyRouter tự động thử model mới nhất kế tiếp trong họ.
Bạn thấy gì và trả bao nhiêu
Trường model trong phản hồi là model cụ thể đã trả lời, ví dụ google/gemini-3.8-flash, nên log và đánh giá luôn trung thực. Thanh toán theo giá của model đó.
Có 19 alias: google/gemini-flash-latest, google/gemini-flash-lite-latest, google/gemini-pro-latest, google/gemma-latest, deepseek/deepseek-latest, deepseek/deepseek-flash-latest, anthropic/claude-opus-latest, anthropic/claude-sonnet-latest, anthropic/claude-haiku-latest, openai/gpt-latest, openai/gpt-mini-latest, openai/gpt-nano-latest, qwen/qwen-max-latest, qwen/qwen-plus-latest, qwen/qwen-flash-latest, z-ai/glm-latest, z-ai/glm-flash-latest, moonshotai/kimi-latest và x-ai/grok-latest.
Alias có thể chuyển sang model mới hơn mà không báo trước, điều này có thể đổi phong cách đầu ra, giá hoặc tham số được hỗ trợ. Hãy ghim ID cụ thể cho workload cần hành vi ổn định. Danh sách models dự phòng do bạn tự gửi được ưu tiên.
Thử ngay
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText } from "ai"
const anyrouter = createAnyRouter()
const { text, response } = await generateText({
model: anyrouter("anthropic/claude-sonnet-latest"),
prompt: "Tóm tắt diff này trong ba gạch đầu dòng.",
})
console.log(text, response.modelId)curl -fsSL https://anyrouter.dev/setup.sh | bash
anyr login
anyr claude --model "anthropic/claude-sonnet-latest"- Ghi chú phát hành — bản thông báo chính thức.
- Tài liệu — cách alias được phân giải.
- Vercel AI SDK, OpenAI SDK và coding agents.
Không có terminal? Mở playground và gửi tin nhắn đầu tiên.
Thử trong playgroundBài liên quan
Use AnyRouter with the Vercel AI SDK
@anyr/ai-sdk-provider wraps the AnyRouter gateway as a standard Vercel AI SDK provider. Call createAnyRouter(), pass a provider/model id, and generateText, streamText, and generateObject work unchanged — switching models is a one-string edit.
Run coding agents through one gateway
Point Claude Code, Codex, OpenCode, Cursor, or any OpenAI-compatible tool at AnyRouter and get one key for every model, unified billing, per-request audit logs, and app attribution. Two environment variables — or one npx command with the anyr CLI launcher.
Use the OpenAI SDK with any model
The official openai package for Python and TypeScript doesn't have to mean OpenAI models. Override base_url and api_key, keep every other call the same, and address 170+ models across 28+ providers as provider/model strings — including OpenAI's own.
Gửi request đầu trong hai phút
Bắt đầu miễn phí với key của bạn, hoặc nạp rồi trả theo token. Go: $4 credit/tháng — $2/tháng, hoặc miễn phí khi góp một provider key.
Bắt đầu miễn phí