Kimi (Moonshot AI) API: endpoints, authentication, models and limits
Connection details
| Base URL | https://api.moonshot.ai/v1 |
| Auth | Bearer token via MOONSHOT_API_KEY |
| OpenAI SDK compatible | Yes |
| SDKs | OpenAI SDK, Anthropic-compatible endpoint, raw HTTP |
Models and token pricing
What is distinctive about this API
- OpenAI-compatible chat completions, with an Anthropic-compatible surface also available — useful if your codebase is already built around Claude-style messages.
- Long-context handling is the headline capability; the K-series models are built for large document and repository ingestion.
- Strong agentic tool-use behaviour, and the open-weight releases can be self-hosted.
Constraints worth knowing first
- Two regional endpoints exist (international and mainland China) with different hosts and separate keys — using the wrong pair returns an auth error that reads like an invalid key.
- Very long contexts raise time-to-first-token substantially; measure prefill latency, not just tokens per second.
Frequently asked
- What is the Kimi (Moonshot AI) API base URL?
- https://api.moonshot.ai/v1. Authenticate with a bearer token, conventionally read from the MOONSHOT_API_KEY environment variable.
- Is the Kimi (Moonshot AI) API compatible with the OpenAI SDK?
- Yes. The chat completions surface is wire-compatible, so the official OpenAI client libraries work by pointing base_url at https://api.moonshot.ai/v1 and supplying a MOONSHOT_API_KEY. No client library change is needed.
- How do I get a Kimi (Moonshot AI) API key?
- Create an account with the provider and generate a key from the developer console, then expose it to your application as MOONSHOT_API_KEY. Keys are secrets: keep them server-side, never in client bundles or committed config.
- Which models does the Kimi (Moonshot AI) API expose?
- Kimi K3, Kimi K2.6. Context windows run to 1049K tokens.
Other provider APIs
Moonshot AI publishes official documentation at https://platform.moonshot.ai/docs. Pricing and limits change; verify against the provider before committing to a budget.