APIs
OpenAI-compatible API
Use the official OpenAI SDKs for chat completions and audio transcription by changing the base URL and the API key.
Esta página ainda não foi traduzida. A versão em inglês está sendo exibida.
Chat and speech-to-text models are served through endpoints that follow the OpenAI API. If your code already uses an OpenAI SDK, two settings change: the base URL and the API key.
| Endpoint | Use |
|---|---|
POST /v1/chat/completions | Chat, with or without streaming |
POST /v1/audio/transcriptions | Speech-to-text |
GET /v1/models | The models available to your organization |
Other OpenAI endpoints are not served. Images, video and music are generated with the Task API.
Point the SDK at Minu
Set the base URL to https://api.minu.ai/v1 and pass your Minu key.
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.MINU_API_KEY,
baseURL: 'https://api.minu.ai/v1',
});import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MINU_API_KEY"],
base_url="https://api.minu.ai/v1",
)The official SDKs also read the environment variables OPENAI_API_KEY and OPENAI_BASE_URL, so a program you cannot change can often be pointed at Minu without touching its code:
export OPENAI_API_KEY="$MINU_API_KEY"
export OPENAI_BASE_URL="https://api.minu.ai/v1"Chat completions
Use a model ID from the model reference, such as deepseek/deepseek-v4.1-flash. Model IDs have the form vendor/model.
const completion = await client.chat.completions.create({
model: 'deepseek/deepseek-v4.1-flash',
messages: [
{ role: 'system', content: 'You answer in one short paragraph.' },
{ role: 'user', content: 'What is an idempotency key?' },
],
});
console.log(completion.choices[0].message.content);
console.log(completion.usage);completion = client.chat.completions.create(
model="deepseek/deepseek-v4.1-flash",
messages=[
{"role": "system", "content": "You answer in one short paragraph."},
{"role": "user", "content": "What is an idempotency key?"},
],
)
print(completion.choices[0].message.content)
print(completion.usage)curl https://api.minu.ai/v1/chat/completions \
-H "Authorization: Bearer $MINU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v4.1-flash",
"messages": [
{ "role": "system", "content": "You answer in one short paragraph." },
{ "role": "user", "content": "What is an idempotency key?" }
]
}'Streaming
Set stream to true to receive the answer as it is written, as server-sent events in the OpenAI format.
const stream = await client.chat.completions.create({
model: 'deepseek/deepseek-v4.1-flash',
messages: [{ role: 'user', content: 'Explain webhooks in three sentences.' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}stream = client.chat.completions.create(
model="deepseek/deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Explain webhooks in three sentences."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Audio transcriptions
Send the audio as a multipart form with the model openai/whisper.
import fs from 'node:fs';
const transcript = await client.audio.transcriptions.create({
file: fs.createReadStream('meeting.mp3'),
model: 'openai/whisper',
});
console.log(transcript.text);with open("meeting.mp3", "rb") as audio:
transcript = client.audio.transcriptions.create(model="openai/whisper", file=audio)
print(transcript.text)curl https://api.minu.ai/v1/audio/transcriptions \
-H "Authorization: Bearer $MINU_API_KEY" \
-F file=@meeting.mp3 \
-F model=openai/whisperThe optional form fields are listed with the model in the model reference.
List models
GET /v1/models returns the models in the shape of the OpenAI models list, with two fields added: modality and kind.
curl https://api.minu.ai/v1/models \
-H "Authorization: Bearer $MINU_API_KEY"{
"object": "list",
"data": [
{
"id": "deepseek/deepseek-v4.1-flash",
"object": "model",
"created": 1796169600,
"owned_by": "deepseek",
"modality": "chat",
"kind": "chat"
},
{
"id": "google/nano-banana-2",
"object": "model",
"created": 1796169600,
"owned_by": "google",
"modality": "image",
"kind": "task"
}
]
}The list holds every model, not only the chat models. kind tells you which API a model belongs to:
kind | Call it with |
|---|---|
chat | POST /v1/chat/completions |
transcription | POST /v1/audio/transcriptions |
task | POST /v1/tasks |
Billing
Chat and transcription calls are paid from the same prepaid balance as tasks, when the call completes.
- Chat is priced per million tokens, with separate prices for input, cached input and output. The
usageobject of the response reports the token counts. - Transcription is priced by the length of the audio.
Prices are published in the catalog: see the pricing page and the model reference. Each call appears in the console under Logs, with its token counts or audio length and its cost.
Errors and limits
- Errors use the same status codes and the same
error.codevalues as the rest of the API, so the SDKs raise their usual exception types. See Errors and rate limits. - The rate limit of your organization covers these endpoints too.
- A key restricted to certain models answers
403 model_not_allowedfor any other model.