Streaming
Responses arrive token by token over server-sent events, with token usage reported at the end of the stream.
Token Factory Live
MarsCompute Token Factory serves leading open models for text and video through one OpenAI-compatible API. One key reaches every model, and prepaid credit means no subscription and no surprise bill.
Already using an OpenAI SDK? Change the base URL and the key, and keep the rest of your code.
Chat completions and streaming in the format your SDK already
speaks. To switch models, change the model
field.
A single key reaches every text and video model. Limit a key to one model when you want to, and revoke it at any time.
Prepaid credit from $10, charged per request at the published price. A request that fails before answering is not charged.
curl https://api.marscompute.ai/v1/chat/completions \
-H "Authorization: Bearer $MARSCOMPUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-30b-a3b-instruct-2507",
"stream": true,
"max_tokens": 256,
"messages": [
{"role": "user", "content": "Count from one to five."}
]
}'
import os
import requests
response = requests.post(
"https://api.marscompute.ai/v1/chat/completions",
headers={
"Authorization": f"Bearer {os.environ['MARSCOMPUTE_API_KEY']}",
},
json={
"model": "qwen3-30b-a3b-instruct-2507",
"messages": [
{"role": "user", "content": "Count from one to five."}
],
"max_tokens": 256,
},
timeout=120,
)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])
const response = await fetch(
"https://api.marscompute.ai/v1/chat/completions",
{
method: "POST",
headers: {
Authorization: "Bearer " + process.env.MARSCOMPUTE_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "qwen3-30b-a3b-instruct-2507",
messages: [{ role: "user", content: "Count from one to five." }],
max_tokens: 256,
}),
},
);
const completion = await response.json();
console.log(completion.choices[0].message.content);
Request path
Five steps, in this order. Keys, prepaid credit and metering are part of the platform, not something you add later.
The key is verified and matched to its workspace, its member and the model the request names.
The largest possible cost of the request is reserved against your credit before anything is sent.
The model answers, whole or as a stream, within the model's limit on concurrent requests. A request that fails before answering is not charged.
The input and output tokens the model reports are recorded with their price.
The reservation is settled to the actual cost, which appears in your usage about a minute later.
Built for production use
Responses arrive token by token over server-sent events, with token usage reported at the end of the stream.
A key belongs to one member and reaches every model. Limit a key to one model if you want, and revoke it on its own.
Each request is metered by input and output tokens and listed with its cost. Export usage as CSV whenever you need it.
Buy credit from $10. Cost is reserved before a request is sent, so spend never runs past your credit.
Invite members to your workspace. Each member signs in with their own email and manages their own keys.
Send an Idempotency-Key header and a repeated
request is not run or charged a second time.
Twenty-one text models take the same chat request. Two video models take a generation job and return an MP4.
Kimi K3, GLM-5.3, DeepSeek V4 Pro, MiniMax M3, Qwen3.8-27B and more, for chat, coding, agents and long tasks.
See the text modelsMiniMax H3 turns text or frames into a 2K clip. Pika H3 Flex takes a prompt and up to 12 references and returns a clip with sound.
See the video modelsSign up and your workspace is ready as soon as you verify your email.