Run Kimi K3 model on Nebius Token Factory¶
Kimi K3 is Moonshot AI's flagship reasoning model, released July 2026 — a major step up in intelligence over the Kimi K2.5 / K2.6 / K2.7 lineage, with multimodal (text + image) input and a 1M-token context window.
- Provider: Moonshot AI (Kimi)
- Architecture: Proprietary — 2.8T parameters
- Context window: 1M tokens
- Strengths: Reasoning, knowledge, mathematics, coding, agentic tasks, multimodal (image) understanding
- License: Proprietary (Moonshot AI)
Key highlights¶
- First Open weights model to approach 3 T parameter count.
- Scores 57 on the Artificial Analysis Intelligence Index, ranking #7 of 190 models (category median: 32)
- Multimodal input — supports text and image; outputs text
References¶
Pre requisites¶
- Nebius API key. Sign up for free at Token Factory
1 - Getting Started¶
1.1 - Get your Nebius API key at Nebius Token Factory¶
1.2 - If running on Google Colab ...¶
Add NEBIUS_API_KEY to Secrets panel on the left as follows

1.3 - If running locally¶
Create an .env file with NEBIUS_API_KEY as follows
NEBIUS_API_KEY=your_api_key_goes_here
2 - Install Dependencies¶
In [1]:
!pip install -q openai python-dotenv
2 - Load Configuration¶
In [2]:
import os, sys
## Recommended way of getting configuration
if os.getenv("COLAB_RELEASE_TAG"):
print("Running in Colab")
from google.colab import userdata
NEBIUS_API_KEY = userdata.get('NEBIUS_API_KEY')
else:
print("NOT running in Colab")
from dotenv import load_dotenv
load_dotenv()
NEBIUS_API_KEY = os.getenv('NEBIUS_API_KEY')
## quick hack (not recommended) - you can hardcode the config key here
# NEBIUS_API_KEY = "your_key_here"
if NEBIUS_API_KEY:
print ('✅ NEBIUS_API_KEY found')
os.environ['NEBIUS_API_KEY'] = NEBIUS_API_KEY
else:
raise RuntimeError ('❌ NEBIUS_API_KEY NOT found')
NOT running in Colab ✅ NEBIUS_API_KEY found
3 - Run the Model¶
3.1 - Initialize the client¶
In [3]:
## Create a client
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.tokenfactory.nebius.com/v1/",
api_key=os.environ.get('NEBIUS_API_KEY')
)
## Select a model
MODEL_NAME = "moonshotai/Kimi-K3"
3.2 - Find out the model's capabilities¶
In [4]:
%%time
completion = client.chat.completions.create(
model = MODEL_NAME,
messages=[
{
"role": "system",
"content": "You are a helpful AI assistant"
},
{
"role": "user",
"content": "What are your capabilities?"
}
],
temperature=0.6
)
print ('----model answer -----')
print (completion.choices[0].message.content)
----model answer ----- I can help with a wide range of tasks. Here's an overview: **Writing & Communication** - Drafting, editing, and proofreading (emails, essays, reports, creative writing) - Summarizing long documents or articles - Adjusting tone and style for different audiences **Analysis & Problem-Solving** - Answering questions across science, history, philosophy, current events, and more - Breaking down complex topics into understandable explanations - Working through logic problems, math, and step-by-step reasoning **Coding & Technical Work** - Writing and debugging code in many programming languages - Explaining code and technical concepts - Helping with system design and architecture decisions **Learning & Creativity** - Tutoring and explaining concepts at any level - Brainstorming ideas, names, and approaches - Translating between languages **Document & Image Understanding** - Analyzing text, documents, and images you share with me **Some limitations to keep in mind:** - My knowledge has a cutoff date, so I may not know very recent events - I can't browse the internet in real-time (in this conversation) - I don't retain memory between separate conversations - I can't take actions in the real world (send emails, make calls, etc.) Is there something specific you'd like help with? I'm happy to demonstrate any of these! CPU times: user 140 ms, sys: 28.6 ms, total: 169 ms Wall time: 13.1 s
3.3 - Ask a factual question¶
In [5]:
%%time
completion = client.chat.completions.create(
model = MODEL_NAME,
messages=[
{
"role": "system",
"content": "You are a helpful AI assistant"
},
{
"role": "user",
"content": "What is the capital of France?"
}
],
temperature=0.6
)
print ('----model answer -----')
print (completion.choices[0].message.content)
print ('\n----- full response ----')
print(completion.to_json())
print ('---------')
----model answer -----
The capital of France is **Paris**. It's also the country's largest city and has served as its capital for centuries. Paris is renowned for landmarks like the Eiffel Tower, the Louvre Museum, and Notre-Dame Cathedral.
----- full response ----
{
"id": "587aab965588448eb3980995908f42b8",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "The capital of France is **Paris**. It's also the country's largest city and has served as its capital for centuries. Paris is renowned for landmarks like the Eiffel Tower, the Louvre Museum, and Notre-Dame Cathedral.",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": null,
"reasoning_content": "The user is asking a simple factual question: what is the capital of France? The answer is Paris. This is a straightforward factual question that deserves a concise, direct answer. I don't need to overthink this one."
},
"matched_stop": 163586
}
],
"created": 1785167554,
"model": "moonshotai/Kimi-K3",
"object": "chat.completion",
"moderation": null,
"service_tier": null,
"system_fingerprint": null,
"usage": {
"completion_tokens": 102,
"prompt_tokens": 112,
"total_tokens": 214,
"completion_tokens_details": null,
"prompt_tokens_details": null,
"reasoning_tokens": 0
},
"metadata": {
"weight_version": "default"
}
}
---------
CPU times: user 13.7 ms, sys: 5.41 ms, total: 19.1 ms
Wall time: 1.76 s
3.4 - Ask a reasoning question¶
In [6]:
%%time
# try another model
completion = client.chat.completions.create(
model = MODEL_NAME,
messages=[
{
"role": "user",
"content": "Which is bigger, 9.9 or 9.11?"
}
],
temperature=0.6
)
print (completion.choices[0].message.content)
print ('----------')
**9.9 is bigger.** Here's why: 9.9 is the same as 9.90, and 9.90 is greater than 9.11. You can think of it in terms of money: $9.90 (nine dollars and ninety cents) is more than $9.11 (nine dollars and eleven cents). The confusion often comes from thinking "11 is bigger than 9," but in decimals, the digits after the point represent fractions — tenths, then hundredths. So: - 9.9 = 9 and 90 hundredths - 9.11 = 9 and 11 hundredths (One caveat: if these were **version numbers**, like software releases, then 9.11 would come *after* 9.9, since version numbering treats them as separate integers — version 9, release 11 versus version 9, release 9.) ---------- CPU times: user 16.4 ms, sys: 3.59 ms, total: 20 ms Wall time: 7.54 s
5 - Try Your Queries¶
Go ahead and experiment with your queries. Here are some to get you started.
Write python code to read a csv file
write a haiku about cats
In [ ]: