Kimi K3 API: price, context window and how to call it
Updated 2026-10-18 · Moonshot AI's flagship through OpenAI- and Anthropic-compatible APIs: price next to Moonshot's own, capabilities, code samples.
Connection details
- Base URL (OpenAI compatible)
- https://api.aifans.fan/v1
- Base URL (Anthropic compatible)
- https://api.aifans.fan
- API key
- Create one in the console; it starts with sk- (no account yet? sign up)
- Recommended models
- deepseek-v4.1-flash, deepseek-v4-pro (all models and prices)
Kimi K3 is Moonshot AI's flagship model for software engineering, knowledge work and long, multi-step agent tasks. AIFans API serves it through OpenAI- and Anthropic-compatible endpoints, so the OpenAI SDKs, Claude Code and most AI tools can call it by changing the base URL, the key and the model name to kimi-k3.
Price
| USD per 1M tokens | Maker's own price | Here | Saving |
|---|---|---|---|
| Input | $3 | $2.9845 | about the same |
| Cached input | $0.3 | $0.2984 | about the same |
| Output | $15 | $14.9225 | about the same |
- Pay as you go per token, no subscription and no minimum spend. Failed calls are never billed.
- Kimi K3 reasons before it answers; that thinking is billed as output tokens, so give max_tokens room (1000 or more).
- Online top-ups carry a payment processing fee of 5.5% (minimum $0.8), added at checkout and shown before you pay; it is not part of your credit.
What it can do
- A context window of about 1 million tokens: whole repositories and long documents fit.
- Native image understanding, alongside text.
- Reasoning (thinking) and structured output; prompt caching makes repeated context cheaper (the cached-input price above).
Why call it here
- One key for Kimi K3 and the other models on the models page: switch by changing the model name.
- Every call is itemised in the console with its tokens and price, with daily, monthly and total spending caps per key.
- Servers in Singapore, close to Southeast Asia, India and East Asia.
Call it with the OpenAI SDK
# pip install openai
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.aifans.fan/v1")
resp = client.chat.completions.create(
model="kimi-k3",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=1000,
)
print(resp.choices[0].message.content)Use it in Claude Code
Put this in ~/.claude/settings.json; the Claude Code guide has the details.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.aifans.fan",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_MODEL": "kimi-k3",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k3",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k3",
"CLAUDE_CODE_SUBAGENT_MODEL": "kimi-k3"
}
}