Moonshot AI's Kimi K2 model is now supported in Vercel AI Gateway

1 min read

You can now access Kimi K2, a new mixture-of-experts (MoE) language model from Moonshot AI, using Vercel's AI Gateway with no other provider accounts required.

AI Gateway lets you call the model with a consistent unified API and just a single string update, track usage and cost, and configure performance optimizations, retries, and failover for higher than provider-average uptime.

To use it with the AI SDK v5, start by installing the package:

pnpm i ai

Then set the model to moonshotai/kimi-k2:

import { streamText } from 'ai'
const result = streamText({
model: 'moonshotai/kimi-k2',
prompt: 'What is the history of the San Francisco Mission-style burrito?'
})

Includes built-in observability, Bring Your Own Key support, and intelligent provider routing with automatic retries.

To deliver high performance and reliability to Kimi K2, AI Gateway leverages multiple model providers under the hood, including direct to Moonshot AI, Groq, DeepInfra, Fireworks AI, and Parasail.

Learn more about AI Gateway.