OpenAI-Compatible API
MinT serves an OpenAI-compatible HTTP surface at /oai/api/v1. Point any
OpenAI SDK or HTTP client at that prefix and you can run inference against a
deployed MinT model without importing mint or tinker.
Concept
There are two ways to talk to MinT, and they serve different jobs:
- Native
mintSDK — training, RL loops, sampling while you train. Use this when you write the loop. See MinT CLI. - OpenAI-compatible API — plain inference against an already-deployed model. Use this when you just want completions, chat, or tool calls from existing OpenAI-SDK code.
This page covers the second case.
This surface is for inference against a deployed model. It does not start, train, or fine-tune anything. For training, use the native SDK.
Configure
The compatible prefix is:
http://<host>:<port>/oai/api/v1Local example:
http://127.0.0.1:8000/oai/api/v1Pick the hosted endpoint that matches your region:
- Outside Mainland China:
https://mint.macaron.xin/oai/api/v1 - Mainland China:
https://mint-cn.macaron.xin/oai/api/v1
For the API key, pass your real MinT key. If the server runs without
authentication, any non-empty string works — the examples use dummy.
Install the SDK:
pip install openaiQuick start
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8000/oai/api/v1",
api_key="dummy",
)
resp = client.chat.completions.create(
model="Qwen/Qwen3-30B-A3B-Instruct-2507",
messages=[{"role": "user", "content": "Reply with exactly: pong"}],
max_tokens=16,
temperature=0.0,
)
print(resp.choices[0].message.content)Supported surface
Verified against a live MinT server:
client.models.list()client.models.retrieve(model_id)client.completions.create(...)(legacy completions)client.chat.completions.create(...)toolsand full tool-call roundtrips- both
OpenAIandAsyncOpenAIclients - small-scale concurrent async chat
Not supported yet
These return an explicit error, not an auth failure:
| Call | Result |
|---|---|
stream=True | stream=True is not supported |
n > 1 | Only n=1 is supported |
client.responses.create(...) | HTTP 404 |
client.embeddings.create(...) | HTTP 404 |
Examples
List and retrieve models
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8000/oai/api/v1", api_key="dummy")
for model in client.models.list().data:
print(model.id)
print(client.models.retrieve("Qwen/Qwen3-30B-A3B-Instruct-2507"))Legacy completions
resp = client.completions.create(
model="Qwen/Qwen3-30B-A3B-Instruct-2507",
prompt="The capital of France is",
max_tokens=16,
temperature=0.1,
)
print(resp.choices[0].text)Chat completions
resp = client.chat.completions.create(
model="Qwen/Qwen3-30B-A3B-Instruct-2507",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Reply with exactly: pong"},
],
max_tokens=16,
temperature=0.0,
)
print(resp.choices[0].message.content)Tool calling roundtrip
Pass tools, read back tool_calls, run the tool yourself, then send the
result in a tool message for the final answer.
import json
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8000/oai/api/v1", api_key="dummy")
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"],
},
},
}
]
question = "What is the weather in Beijing? Call the tool, then answer."
first = client.chat.completions.create(
model="Qwen/Qwen3-30B-A3B-Instruct-2507",
messages=[{"role": "user", "content": question}],
tools=tools,
tool_choice="required", # force a tool call before the model answers
max_tokens=128,
temperature=0.1,
)
call = first.choices[0].message.tool_calls[0]
second = client.chat.completions.create(
model="Qwen/Qwen3-30B-A3B-Instruct-2507",
messages=[
{"role": "user", "content": question},
{
"role": "assistant",
"content": None,
"tool_calls": [
{
"id": call.id,
"type": "function",
"function": {
"name": call.function.name,
"arguments": call.function.arguments,
},
}
],
},
{
"role": "tool",
"tool_call_id": call.id,
"content": json.dumps({"location": "Beijing", "weather": "Sunny, 18C"}),
},
],
tools=tools,
max_tokens=128,
temperature=0.1,
)
print(second.choices[0].message.content)Async client
import asyncio
from openai import AsyncOpenAI
client = AsyncOpenAI(base_url="http://127.0.0.1:8000/oai/api/v1", api_key="dummy")
async def main():
resp = await client.chat.completions.create(
model="Qwen/Qwen3-30B-A3B-Instruct-2507",
messages=[{"role": "user", "content": "Reply with exactly: async-pong"}],
max_tokens=16,
temperature=0.0,
)
print(resp.choices[0].message.content)
asyncio.run(main())Try it in the quickstart
The mint-quickstart repo ships a runnable version of these calls:
MINT_BASE_URL=http://127.0.0.1:8000 \
MINT_API_KEY=dummy \
python quickstart/openai_compat.py chat \
--model Qwen/Qwen3-30B-A3B-Instruct-2507 \
--user-message "Reply with exactly: pong"The script has completions, chat, tool, and smoke subcommands. Run
smoke to check the whole supported surface at once.
Limitations
This API targets development and internal use, not large user-facing traffic. Latency and throughput depend on the deployed model and may change. For training-time inference (for example inside an RL loop), use the native sampling client instead of this endpoint.