Kimi AI App Try Now

Kimi API Overview: Master Advanced Context Models

Unlock the power of Moonshot AI with a 256K context window and native multimodal capabilities at a fraction of the cost.

Get Started Now

Kimi API Overview

Kimi API Overview

The Kimi API provides access to Moonshot AI's Kimi K2.5, a 1 trillion parameter MoE model with native multimodal capabilities, 256K token context window, and agentic features. The REST-based interface enables integration into applications requiring advanced reasoning, vision understanding, document analysis, and multi-agent workflows. Available through the official Moonshot platform and third-party providers including OpenRouter, Together AI, and NVIDIA NIM.

For developers familiar with OpenAI's ecosystem, migration is straightforward. The API maintains full compatibility with OpenAI SDK structure, requiring only base URL and API key changes. Authentication uses standard Bearer token authorization. Official SDKs for Python and Node.js handle request management, while the open-source model weights on Hugging Face enable self-hosted deployment for teams requiring full control over their infrastructure.

What sets this API apart? The combination of a 256K context window, native vision capabilities, and Agent Swarm mode at pricing approximately 4x cheaper than Claude Opus 4.5. Complex RAG pipelines become simpler when your model processes entire documentation sets in one pass while also understanding images, charts, and video content natively.

Feature Details
Current Model Kimi K2.5 (kimi-k2.5)
Context Window 262,144 tokens (256K)
Input Types Text, images, video, documents
Authentication Bearer token via Authorization header
SDKs Python, Node.js (OpenAI-compatible)
Providers Moonshot Official, OpenRouter, Together AI, NVIDIA NIM

The API endpoints mirror OpenAI's structure for chat completions, supporting JSON responses, streaming output, and function calling for building agentic workflows. Access to Kimi through the API means leveraging K2.5's full capabilities including all four operational modes: Instant, Thinking, Agent, and Agent Swarm.

  • OpenAI-compatible REST endpoints reduce refactoring when switching providers.
  • Streaming responses enable progressive UI updates during generation.
  • Function calling support for tool use and structured outputs.
  • Native multimodal input accepts images and video alongside text.
  • Automatic context caching reduces repeat input costs by 75%.

Getting Started with the API

Getting Started with the API

Registration takes minutes. Visit platform.moonshot.ai, create an account with email verification, and navigate to the API keys section. The platform provides documentation in both English and Chinese, with code examples covering common integration patterns.

  1. Register at platform.moonshot.ai and verify your email address.
  2. Navigate to the API Keys section in the developer dashboard.
  3. Generate your first API key. Store it securely as it cannot be retrieved after creation.
  4. Install the OpenAI Python SDK or use cURL directly. The Kimi API accepts standard OpenAI-format requests.
from openai import OpenAI

client = OpenAI(
    api_key="your_moonshot_api_key",
    base_url="https://api.moonshot.cn/v1"
)

response = client.chat.completions.create(
    model="kimi-k2.5",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain the MoE architecture."}
    ],
    temperature=0.7
)

print(response.choices[0].message.content)

This code works identically to OpenAI API calls. Switching from GPT models requires changing only the base_url and api_key parameters. Existing error handling, retry logic, streaming implementations, and response parsing transfer without modification.

API Pricing

API Pricing

Kimi K2.5 offers competitive pricing across multiple providers, with automatic context caching on the official API reducing input costs by 75% for repeated contexts.

Provider Input (per 1M tokens) Output (per 1M tokens) Cached Input
Moonshot Official $0.60 $3.00 $0.15 (75% off)
OpenRouter $0.45 $2.20 Varies
Together AI $0.50 $2.80 Varies

These prices position Kimi K2.5 at approximately 4x cheaper than Claude Opus 4.5 for equivalent context lengths and capabilities. The automatic context caching feature activates transparently when the same system prompt or document prefix is reused across requests, requiring no code changes.

Rate Limits and Tiers

Rate Limits and Tiers

The official API uses a tiered system based on cumulative account recharge amount. Higher tiers unlock increased concurrency and request rates.

Tier Cumulative Recharge Concurrent Requests Requests per Minute
Tier 1 $10 50 200
Tier 2 $100 100 500
Tier 3 $500 300 2,000
Tier 5 $3,000 1,000 10,000

For applications requiring higher limits, enterprise plans with custom rate limits are available through direct contact with Moonshot AI's sales team.

Multimodal API Usage

Multimodal API Usage

Kimi K2.5's native multimodal architecture accepts images and video directly in API requests. The MoonViT-3D vision encoder processes variable-resolution inputs without requiring preprocessing or resizing on the client side.

response = client.chat.completions.create(
    model="kimi-k2.5",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe this chart and extract the data."},
                {"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
            ]
        }
    ]
)

The vision capabilities score 92.3% on OCRBench and 92.6% on InfoVQA, making Kimi K2.5 particularly strong at document understanding, chart analysis, and data extraction from images. Video inputs are supported by passing multiple frames or video URLs.

Alternative Access Methods

Alternative Access Methods

Beyond the official API, Kimi K2.5 is accessible through several third-party platforms and self-hosting options.

  • OpenRouter (openrouter.ai): Aggregated access with unified billing across multiple AI providers. Useful for applications that need fallback routing between models.
  • Together AI (together.ai): Optimized inference infrastructure with competitive pricing and low-latency serving.
  • NVIDIA NIM: Enterprise deployment through NVIDIA's inference microservices platform.
  • Self-hosted: Download from Hugging Face (moonshotai/Kimi-K2.5) in block-fp8 format. Deploy via vLLM, SGLang, Transformers, or Docker. Requires significant GPU resources for the full 1T parameter model.

Kimi API FAQ

Is the Kimi API compatible with OpenAI SDK?

Fully compatible. Change the base_url to api.moonshot.cn/v1 and use your Moonshot API key. Chat completions, function calling, streaming, and structured outputs work identically. No code changes beyond the connection parameters are needed.

What is the maximum context window supported?

Kimi K2.5 supports a massive context window of up to 262,144 tokens (256K), allowing for processing of entire codebases or long documents without chunking.

How do I save costs with context caching?

Automatic context caching activates when the same prefix (system prompt, documents) appears in consecutive requests. Cached tokens cost $0.15 per million instead of $0.60, a 75% reduction.

Can I process images and video with the API?

Yes, Kimi K2.5 is natively multimodal. You can send images and video URLs directly in the chat messages for analysis, chart reading, and data extraction.

Where can I get an API key?

Register at platform.moonshot.ai, verify your email, and generate a key in the API Keys section of the developer dashboard.

Are there third-party providers for Kimi API?

Yes, you can access Kimi K2.5 through OpenRouter, Together AI, and NVIDIA NIM, providing options for unified billing or optimized inference.

Is Kimi K2.5 open-source?

Yes, the model weights are available on Hugging Face under a Modified MIT License. You can deploy them using vLLM, SGLang, or Docker.

How are rate limits determined?

The official API uses a tiered system based on your cumulative account recharge amount. Higher tiers unlock increased concurrency and higher requests per minute.

What SDKs are available?

Since it is OpenAI-compatible, official SDKs for Python and Node.js work out of the box. Any standard library that supports REST requests can be used.

Is there a lighter version of the model for self-hosting?

Yes, Kimi Linear (48B MoE, 3B active) is a lighter alternative for resource-constrained deployments compared to the full 1T parameter model.