Dùng Kimi K2.6 qua API Moonshot bằng base url và gọi /chat/completions; điểm cần kiểm chứng là model ID, nên lấy từ GET /models trong tài khoản thay vì đoán hoặc copy từ gateway khác. Các endpoint cần nhớ: /chat/completions để chat, /models để liệt kê model, /users/me/balance để kiểm tra số dư và /batches cho batch.

Create a landscape editorial hero image for this Studio Global article: Cách dùng Kimi K2.6 qua API Moonshot: endpoint đúng và model ID. Article summary: Dùng Kimi K2.6 qua API Moonshot bằng OpenAI SDK với base url https://api.moonshot.ai/v1, rồi gọi /chat/completions; điểm cần kiểm chứng là model ID, nên gọi /models trong tài khoản thay vì đoán.. Topic tags: ai, kimi, moonshot ai, llm, api. Reference image context from search candidates: Reference image 1: visual subject "# Moonshot AI (Kimi K2.6). ## Step 1: Create a Moonshot API account. Go to and create a new Moonshot API account. ## Step 2: Set up Moonshot API account. To use the model via API," source context "Moonshot AI (Kimi K2.6)" Reference image 2: visual subject "Connect and use Kimi K2.6 from Moonshot AI with API Key - Featured image. # How to use Kimi K2.6 from Moonshot AI with API Key on TypingMind. Learn how to access and
Với Kimi K2.6, lỗi dễ gặp nhất không phải là URL gọi API mà là nhầm model giữa Moonshot và các nhà cung cấp trung gian. Kimi Open Platform cho biết API HTTP của họ tương thích OpenAI, có thể dùng OpenAI SDK trực tiếp, và khi dùng SDK cần đặt base_url là https://api.moonshot.ai/v1; nếu gọi HTTP trực tiếp, endpoint chat đầy đủ là https://api.moonshot.ai/v1/chat/completions. [13]
Điểm cần thận trọng: trang List Models thông báo Kimi K2.6 đã được phát hành, nhưng mẫu phản hồi được cung cấp trong tài liệu vẫn minh họa id là kimi-k2.5. Vì vậy, cách an toàn là gọi GET /modelsid mà API trả về. [17]
Studio Global AI
Use this topic as a starting point for a fresh source-backed answer, then compare citations before you share it.
Dùng Kimi K2.6 qua API Moonshot bằng base url https://api.moonshot.ai/v1 và gọi /chat/completions; điểm cần kiểm chứng là model ID, nên lấy từ GET /models trong tài khoản thay vì đoán hoặc copy từ gateway khác.
Dùng Kimi K2.6 qua API Moonshot bằng base url https://api.moonshot.ai/v1 và gọi /chat/completions; điểm cần kiểm chứng là model ID, nên lấy từ GET /models trong tài khoản thay vì đoán hoặc copy từ gateway khác. Các endpoint cần nhớ: /chat/completions để chat, /models để liệt kê model, /users/me/balance để kiểm tra số dư và /batches cho batch.
ID như moonshot/kimi k2 6 của AIMLAPI hoặc moonshotai/kimi k2.6 của OpenRouter là ID theo nhà cung cấp, không nên tự động dùng trên endpoint Moonshot chính thức.
Tiếp tục với "Tháng 4/2026: xuất khẩu xe điện Trung Quốc lần đầu vượt xe xăng/dầu" để có góc nhìn khác và trích dẫn bổ sung.
Open related pageKiểm tra chéo câu trả lời này với "Bitmine gom 5,18 triệu ETH: Mục tiêu 5% Ethereum và phép thử MAVAN".
Open related pageimport requests import requests import json for getting a structured output with indentation import json for getting a structured output with indentation response = requests.post( response = requests.post( " " headers={ headers={ Insert your AIML API Key in...
Moonshot AI (Kimi K2.6). Step 1: Create a Moonshot API account. Go to and create a new Moonshot API account. Step 2: Set up Moonshot API account. To use the model via API, you’ll need to add balance to your account. Step 3: Get your Moonshot API key. Be sur...
MoonshotAI: Kimi K2.6. moonshotai/kimi-k2.6. Kimi K2.6 is Moonshot AI's next-generation multimodal model, designed for long-horizon coding, coding-driven UI/UX generation, and multi-agent orchestration. It handles complex end-to-end coding tasks across Pyth...
Using the API. API Reference. Batch API. API Overview. Kimi Open Platform provides OpenAI-compatible HTTP APIs. You can use the OpenAI SDK directly. When using SDKs, set base url to When calling HTTP endpoints directly, use the full path such as OpenAI Co...
| Nhu cầu |
|---|
| Cấu hình hoặc endpoint |
|---|
| Ghi chú |
|---|
| Dùng OpenAI SDK | | Kimi mô tả API là OpenAI-compatible và cho phép dùng OpenAI SDK trực tiếp. [ |
| Gọi chat realtime | | API overview nêu full path này; tài liệu Chat API dùng request theo kiểu model và messages. [ |
| Liệt kê model | | Endpoint trả danh sách model và mẫu phản hồi có trường id. [ |
| Kiểm tra số dư | | Tài liệu Check Balance dùng header |
| Tạo batch | | Tài liệu Batch API có endpoint tạo batch. [ |
Authorization: Bearer ...base_url sang https://api.moonshot.ai/v1. [/models trước khi gửi request thật. Endpoint List Models được thiết kế để liệt kê các model hiện có và mẫu phản hồi có trường id; đây là giá trị nên truyền vào tham số model. [model và messages. Tài liệu Chat API thể hiện request theo cấu trúc có model và messages, còn API overview nêu endpoint /chat/completions. [Đoạn dưới dùng đúng base_url do Kimi công bố cho OpenAI SDK. [13] Biến
KIMI_MODEL_ID phải là id lấy từ GET /models17]
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MOONSHOT_API_KEY"],
base_url="https://api.moonshot.ai/v1",
)
response = client.chat.completions.create(
model=os.environ["KIMI_MODEL_ID"],
messages=[
{"role": "user", "content": "Xin chào, hãy tự giới thiệu ngắn gọn."}
],
)
print(response)Bước đầu tiên nên là liệt kê model trong tài khoản Moonshot/Kimi của bạn, vì endpoint này trả danh sách model cùng trường id. [17]
curl -sS https://api.moonshot.ai/v1/models \
-H "Authorization: Bearer $MOONSHOT_API_KEY"Sau khi chọn đúng id từ phản hồi, gửi request tới Chat Completions. Full path /chat/completions và cấu trúc request model + messages đều được mô tả trong tài liệu Kimi. [13][
14]
curl -sS https://api.moonshot.ai/v1/chat/completions \
-H "Authorization: Bearer $MOONSHOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "PASTE_MODEL_ID_FROM_MODELS",
"messages": [
{"role": "user", "content": "Viết một đoạn giới thiệu ngắn về Kimi K2.6."}
]
}'Nếu request lỗi do billing hoặc bạn muốn kiểm tra tài khoản trước khi tích hợp, Kimi có endpoint balance tại /users/me/balance và ví dụ tài liệu dùng Bearer token. [15]
curl -sS https://api.moonshot.ai/v1/users/me/balance \
-H "Authorization: Bearer $MOONSHOT_API_KEY"Một số nhà cung cấp trung gian đặt model ID riêng cho Kimi K2.6. AIMLAPI dùng endpoint https://api.aimlapi.com/v1/chat/completions với model moonshot/kimi-k2-6. [1] OpenRouter hiển thị model
moonshotai/kimi-k2.6 trên trang API của họ. [5]
Các ID đó chỉ nên dùng khi bạn gọi qua đúng gateway tương ứng. Khi gọi endpoint chính thức https://api.moonshot.ai/v1/chat/completions, cách ít rủi ro nhất là gọi GET https://api.moonshot.ai/v1/modelsid mà Moonshot trả về cho tài khoản của bạn. [13][
17]
Luồng triển khai gọn nhất là: lấy API key, đặt OpenAI SDK base_url thành https://api.moonshot.ai/v1, gọi /models để xác minh model ID Kimi K2.6, rồi gửi request tới /chat/completions với model và messages. Cách này bám sát tài liệu OpenAI-compatible của Kimi và tránh lỗi phổ biến là copy model ID của AIMLAPI hoặc OpenRouter sang endpoint Moonshot chính thức. [1][
5][
13][
14][
17]
Xe điện và hybrid sạc điện Trung Quốc lần đầu vượt xe xăng/dầu trong xuất khẩu
create( model = "kimi-k2.5", model = "kimi-k2.5", messages = [ messages = [ {"role": "system", "content": "You are Kimi, an AI assistant provided by Moonshot AI. {{ "id": "cmpl-04ea926191a14749b7f2c7a48a68abc6", "id": "cmpl-04ea926191a14749b7f2c7a48a68abc6"...
Kimi API Platform home pagelight logodark logo. Using the API. API Reference. Batch API. curl --request GET \ curl --request GET \ --url \ --url \ --header 'Authorization: Bearer ' --header 'Authorization: Bearer '. {{ "code": 123, "code": 123, "data": { "d...
curl --request POST \ curl --request POST \ --url \ --url \ --header 'Authorization: Bearer ' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \ --data ' --data '{{ "input file id":...
🎉 Kimi K2.6 has been released with improved long-context coding stability. Top-up bonus event in progress 🔗. Kimi API Platform home pagelight logodark logo. Using the API. Capabilities. API Reference. Files. Batch API. curl --request GET \ --url \ --heade...