はじめに
Quickstart
Create an API key, generate an image with the Task API, and make a chat call with the OpenAI SDK.
このページはまだ翻訳されていません。英語版を表示しています。
This page takes you from nothing to a finished image and a chat reply. You need a terminal with curl, or Node.js 18+ or Python 3.
1. Get an API key
- Sign in to the console with your e-mail address. There is no password: you receive a six-digit code. The first sign-in creates your account and an organization.
- Open Billing and top up. The smallest package is $5.
- Open API keys, create a key and copy it. The full key is shown once.
Put the key in an environment variable so it stays out of your code:
export MINU_API_KEY="mk_live_…"2. Check that the key works
curl https://api.minu.ai/v1/balance \
-H "Authorization: Bearer $MINU_API_KEY"{
"object": "balance",
"currency": "usd",
"balance_usd": "5.000000",
"reserved_usd": "0.000000",
"available_usd": "5.000000"
}3. Create a task
Images, video and music are made by tasks: you create one, it runs, and you fetch the result. This creates an image with Nano Banana 2:
curl https://api.minu.ai/v1/tasks \
-H "Authorization: Bearer $MINU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana-2",
"input": {
"prompt": "A paper boat on a rain puddle, macro, soft morning light"
}
}'const headers = {
Authorization: `Bearer ${process.env.MINU_API_KEY}`,
'Content-Type': 'application/json',
};
let task = await fetch('https://api.minu.ai/v1/tasks', {
method: 'POST',
headers,
body: JSON.stringify({
model: 'google/nano-banana-2',
input: { prompt: 'A paper boat on a rain puddle, macro, soft morning light' },
}),
}).then((response) => response.json());
console.log(task.id, task.status);import os
import requests
headers = {"Authorization": f"Bearer {os.environ['MINU_API_KEY']}"}
task = requests.post(
"https://api.minu.ai/v1/tasks",
headers=headers,
json={
"model": "google/nano-banana-2",
"input": {"prompt": "A paper boat on a rain puddle, macro, soft morning light"},
},
).json()
print(task["id"], task["status"])The response is the task. It starts as queued, and its price is reserved from your balance:
{
"id": "task_1k8r2m4p0a7c9e3g5j6n8q2s",
"object": "task",
"model": "google/nano-banana-2",
"status": "queued",
"input": { "prompt": "A paper boat on a rain puddle, macro, soft morning light" },
"outputs": [],
"error": null,
"estimated_cost_usd": "0.033000",
"cost_usd": null,
"metadata": null,
"created_at": 1796169600,
"started_at": null,
"completed_at": null
}The input you get back also holds the model's defaults for the parameters you left out.
4. Get the result
Ask for the task until its status is final:
curl https://api.minu.ai/v1/tasks/task_1k8r2m4p0a7c9e3g5j6n8q2s \
-H "Authorization: Bearer $MINU_API_KEY"const done = ['succeeded', 'partially_succeeded', 'failed', 'canceled', 'expired'];
while (!done.includes(task.status)) {
await new Promise((resolve) => setTimeout(resolve, 2000));
task = await fetch(`https://api.minu.ai/v1/tasks/${task.id}`, { headers }).then((response) => response.json());
}
console.log(task.status, task.outputs);import time
done = {"succeeded", "partially_succeeded", "failed", "canceled", "expired"}
while task["status"] not in done:
time.sleep(2)
task = requests.get(f"https://api.minu.ai/v1/tasks/{task['id']}", headers=headers).json()
print(task["status"], task["outputs"])A finished task lists its results in outputs and says what it cost:
{
"id": "task_1k8r2m4p0a7c9e3g5j6n8q2s",
"object": "task",
"model": "google/nano-banana-2",
"status": "succeeded",
"outputs": [
{ "index": 0, "type": "image", "url": "https://…", "mime": "image/png", "bytes": 1482930 }
],
"error": null,
"estimated_cost_usd": "0.033000",
"cost_usd": "0.033000",
"completed_at": 1796169612
}Download the file from url. Result files are kept for 14 days by default.
If the task had failed, status would be failed, error would say why and cost_usd would be "0.000000": you pay only for results that are delivered.
5. Make a chat call
Chat models speak the OpenAI API. Install the official SDK (npm install openai or pip install openai) and point it at Minu:
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.MINU_API_KEY,
baseURL: 'https://api.minu.ai/v1',
});
const completion = await client.chat.completions.create({
model: 'deepseek/deepseek-v4.1-flash',
messages: [{ role: 'user', content: 'Write a haiku about queues.' }],
});
console.log(completion.choices[0].message.content);import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MINU_API_KEY"],
base_url="https://api.minu.ai/v1",
)
completion = client.chat.completions.create(
model="deepseek/deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Write a haiku about queues."}],
)
print(completion.choices[0].message.content)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": "user", "content": "Write a haiku about queues." }]
}'Model IDs are listed in the model reference and returned by GET /v1/models.
Next steps
- Task API: every field of a task, idempotent retries, listing and canceling.
- Webhooks: receive results instead of polling, and verify the signature.
- Files: upload an image to use as a task input.
- Errors and rate limits: what to retry and when.
- Model reference: parameters and prices of each model.