İçeriğe geç
Dokümanlar:Migrating from kie.ai

Kılavuzlar

Migrating from kie.ai

Keep your kie.ai integration and point it at Minu. What works unchanged, what behaves differently, and what does not carry over.

Bu sayfa henüz çevrilmedi. İngilizce sürümü gösteriliyor.

Minu serves a set of routes that take the requests kie.ai takes and answer in the shapes kie.ai answers in. For the models in Minu's catalog, an integration written for kie.ai moves over by changing two values:

kie.aiMinu
Base URLhttps://api.kie.aihttps://api.minu.ai
API keyyour kie.ai keya Minu key, mk_live_…

The header stays the same: Authorization: Bearer <key>.

This page lists what maps one to one and, just as plainly, what does not. Read that section before you switch production traffic.

Before you switch

  1. Create a Minu account, top up, and create an API key. Minu bills in US dollars from a prepaid balance, not in credits.
  2. If you verify callback signatures, create a signing secret in the console under Webhooks. You will need it in place of your kie.ai webhook key.
  3. Check that the models you use are in the catalog.

Routes that are served

RouteUse
POST /api/v1/jobs/createTaskCreate a generation task
GET /api/v1/jobs/recordInfoRead a task created with createTask
POST /api/v1/veo/generateCreate a Veo video
GET /api/v1/veo/record-infoRead a task created with veo/generate

GET /api/v1/chat/credit is answered as well, for code that reads it: it returns your available balance converted to kie.ai credits at 200 credits to the US dollar, rounded down to two decimals. The balance in dollars is GET /v1/balance. Other kie.ai routes are not served.

Shell
# Before
curl https://api.kie.ai/api/v1/jobs/createTask \
  -H "Authorization: Bearer $KIE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "YOUR_MODEL_NAME", "input": { "prompt": "A paper boat on a rain puddle" } }'

# After: another host, another key, the same request
curl https://api.minu.ai/api/v1/jobs/createTask \
  -H "Authorization: Bearer $MINU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "YOUR_MODEL_NAME", "input": { "prompt": "A paper boat on a rain puddle" } }'

Responses and errors

As at kie.ai, every answer is HTTP 200 and the outcome is in the body. A request that was accepted answers { "code": 200, "msg": "success", "data": … }; the two create routes return "data": { "taskId": "task_…" }. A request that was refused answers { "code": …, "msg": "…" } with one of these codes:

codeWhen
401The key cannot be used: it is invalid or revoked, not allowed from this IP address or for this model, or the organization is suspended.
402The balance is too low, or the key has reached its daily spend cap.
422The request cannot be served as sent: a missing or invalid field, a model that is not supported, content that was blocked, an input file that cannot be used.
429Too many requests, or too many tasks waiting. The Retry-After header says how long to wait.
500Something went wrong on Minu's side.

Check code in the body, as you do with kie.ai, not the HTTP status.

Model names

Send the model values you send to kie.ai today. These names are recognised, in any letter case, and run the Minu model beside them; the name you sent is what you get back in the record.

kie.ai modelMinu model
nano-banana-2-litegoogle/nano-banana-2-lite
nano-banana-2, google/nano-banana, google/nano-banana-editgoogle/nano-banana-2
nano-banana-progoogle/nano-banana-pro
veo3_lite, veo-3-1-litegoogle/veo-3.1-lite
veo3_fast, veo-3-1, veo-3-1-fastgoogle/veo-3.1-fast

POST /api/v1/veo/generate without a model uses veo3_fast, which is kie.ai's own default. A Minu model ID from the model reference is accepted as model too, which is how you reach the task models that have no kie.ai name here. Any other name is refused with code 422.

Request fields

Requests are read with kie.ai's field names and turned into the model's own parameters:

  • Image models (createTask): prompt; reference images from image_input, image_urls or imageUrls, as a list of URLs or a single URL; the aspect ratio from aspect_ratio, aspectRatio or image_size, where auto means the model's default; seed or seeds; n. resolution: "1K" is accepted.
  • Video models (veo/generate, or createTask with a video model): prompt; reference images from imageUrls, image_urls or image_input; aspectRatio or aspect_ratio; seeds or seed; resolution; duration; and generationType TEXT_2_VIDEO or REFERENCE_2_VIDEO.
  • callBackUrl: an empty string means no callback, as at kie.ai.

The result is then checked against the model's parameters, which the model reference lists with their allowed values. A value the model does not take is refused with code 422 and a msg that names the field.

Task IDs

taskId values are Minu task IDs. They start with task_ and do not look like kie.ai's. Treat them as opaque strings, and make sure the column you store them in is long enough.

What maps one to one

Job records

GET /api/v1/jobs/recordInfo returns the record in the data field of kie.ai's usual code / msg / data envelope, with the fields kie.ai uses:

JSON
{
  "taskId": "task_1k8r2m4p0a7c9e3g5j6n8q2s",
  "model": "YOUR_MODEL_NAME",
  "state": "success",
  "param": "{\"model\":\"YOUR_MODEL_NAME\",\"input\":{\"prompt\":\"A paper boat on a rain puddle\"}}",
  "resultJson": "{\"resultUrls\":[\"https://…\"]}",
  "failCode": "",
  "failMsg": "",
  "costTime": 11840,
  "completeTime": 1796169611840,
  "createTime": 1796169600000,
  "creditsConsumed": 0
}
FieldValue
taskIdThe Minu task ID.
modelThe model name you sent.
statewaiting, queuing, generating, success or fail. See the table below.
paramYour request as a JSON string: model and input.
resultJsonWhen state is success, a JSON string holding resultUrls, the list of result files. Otherwise an empty string.
failCodeWhen state is fail: "400" for a rejected request or an unusable input, "422" for content that was refused, "500" for anything else. Otherwise an empty string.
failMsgWhen state is fail, the reason. Otherwise an empty string.
costTimeMilliseconds from creation to completion. 0 until the task ends.
completeTimeWhen the task ended, in Unix milliseconds. 0 until then.
createTimeWhen the task was created, in Unix milliseconds.
creditsConsumedAlways 0. See what does not map.

resultJson and param are JSON strings, as at kie.ai: parse them a second time.

Minu's task statuses appear as kie.ai states:

Minu statusstate
queuedwaiting
preparingqueuing
running, finalizinggenerating
succeeded, partially_succeededsuccess
failed, canceled, expiredfail

Veo records

GET /api/v1/veo/record-info returns, in data:

JSON
{
  "taskId": "task_1k8r2m4p0a7c9e3g5j6n8q2s",
  "paramJson": "{\"prompt\":\"A slow dolly shot through a bamboo forest\"}",
  "completeTime": 1796169671000,
  "response": {
    "taskId": "task_1k8r2m4p0a7c9e3g5j6n8q2s",
    "resultUrls": ["https://…"],
    "originUrls": ["https://…"],
    "fullResultUrls": ["https://…"],
    "resolution": "720p"
  },
  "successFlag": 1,
  "errorCode": null,
  "errorMessage": null,
  "createTime": 1796169600000,
  "fallbackFlag": false
}
FieldValue
taskIdThe Minu task ID.
paramJsonThe task's input as a JSON string.
successFlag0 in progress, 1 done, 2 refused (the content, the input or the request was rejected), 3 failed.
responseWhen successFlag is 1: taskId, resultUrls, originUrls, fullResultUrls and resolution. The three URL lists hold the same files. Otherwise null.
errorCodeWhen successFlag is 2 or 3: 400, 422 or 500, as a number. Otherwise null.
errorMessageWhen successFlag is 2 or 3, the reason. Otherwise null.
completeTimeWhen the task ended, in Unix milliseconds, or null.
createTimeWhen the task was created, in Unix milliseconds.
fallbackFlagAlways false.

Callbacks

A task created with a callBackUrl posts one callback to that URL when it ends, in kie.ai's format for the route that created it.

For jobs/createTask:

JSON
{
  "code": 200,
  "msg": "success",
  "data": { "taskId": "task_1k8r2m4p0a7c9e3g5j6n8q2s", "state": "success", "resultJson": "{\"resultUrls\":[\"https://…\"]}" }
}

data is the full job record described above (shortened here). code is 200 on success and 501 on failure, where msg carries the reason.

For veo/generate:

JSON
{
  "code": 200,
  "msg": "Veo3 video generated successfully.",
  "data": {
    "taskId": "task_1k8r2m4p0a7c9e3g5j6n8q2s",
    "info": {
      "taskId": "task_1k8r2m4p0a7c9e3g5j6n8q2s",
      "resultUrls": ["https://…"],
      "originUrls": ["https://…"],
      "fullResultUrls": ["https://…"],
      "resolution": "720p"
    },
    "fallbackFlag": false
  }
}

On failure code is 400, 422 or 500, msg carries the reason and info is null.

A callback that your server does not answer with a 2xx status within 10 seconds is retried on the same schedule as Minu webhooks: eight attempts over about 33 hours.

Callback signatures

Callbacks are signed the way kie.ai signs them, with two headers:

HeaderValue
x-webhook-timestampWhen the callback was sent, in Unix seconds.
x-webhook-signatureHMAC-SHA256 over taskId.timestamp, encoded as base64.

The key is your organization's Minu signing secret (the whole string, including whsec_), not your kie.ai webhook key. The headers are sent once your organization has a signing secret.

import crypto from 'node:crypto';

// `body` is the parsed JSON of the callback; `secret` is the Minu signing secret (whsec_…).
function verifyCallback(headers, body, secret) {
  const timestamp = headers['x-webhook-timestamp'];
  const signature = headers['x-webhook-signature'];
  const taskId = body?.data?.taskId;
  if (!timestamp || !signature || !taskId) return false;

  const expected = crypto.createHmac('sha256', secret).update(`${taskId}.${timestamp}`).digest('base64');
  const given = Buffer.from(String(signature));
  const wanted = Buffer.from(expected);
  return given.length === wanted.length && crypto.timingSafeEqual(given, wanted);
}

What does not map

These differ from kie.ai. None of them is an error on your side, but each can surprise you.

WhatHow it behaves at Minu
enableTranslationIgnored. The prompt is used as you wrote it. If you relied on this option to translate prompts, translate them before you send them. watermark and output_format are accepted and ignored as well.
creditsConsumedAlways 0. Minu does not count in credits. The cost in dollars is on the task: GET /v1/tasks/{taskId} returns cost_usd, and the console lists every task with its cost.
2K and 4K images, video above 720pNot available yet, and refused rather than made smaller. Images are generated at 1K and video at 720p. A request for 2K or 4K, or for a video resolution the model does not list, is answered with code 422.
generationType: FIRST_AND_LAST_FRAMES_2_VIDEORefused with code 422. Images sent with a video request are reference images of people or objects the video should keep, not its first and last frames. Use TEXT_2_VIDEO, or REFERENCE_2_VIDEO with reference images.
Aspect ratiosOnly the ratios the model reference lists for the model are accepted. Others are refused with code 422; auto selects the default.
veo-3-1Without a tier, veo-3-1 means Fast (Veo 3.1 Fast).
fallbackFlagAlways false.
Webhook endpoints in the Minu consoleA task created through these routes sends its callback only to its own callBackUrl. Endpoints set up in the console receive events for Task API tasks, not for these.
BillingA prepaid balance in US dollars, not credits.
Other routes of the kie.ai APINot served. Only the routes listed above are.

Two more things to keep in mind:

  • Limits are Minu's. The default rate limit is 20 requests per 10 seconds per organization, and tasks beyond your concurrency limit wait in a bounded queue. See Errors and rate limits.
  • Result files are kept for 14 days by default. Download what you need to keep.

Check your migration

  1. Create one task per model you use, with a real prompt, against https://api.minu.ai.
  2. Poll recordInfo or record-info until the task ends and confirm that your code reads resultUrls as before.
  3. If you use callbacks, confirm that one arrives and that your signature check passes with the Minu signing secret.
  4. Open Logs in the console and check the cost of each task.

Moving to the Task API later

The compatible routes are there so that you can switch without rewriting your integration. When you next touch it, the Task API gives you more: the cost of each task in the response, your own metadata on every task, safe retries with Idempotency-Key, cancellation, and webhook endpoints with signatures that survive a secret rotation. A task created through either API can be read with GET /v1/tasks/{id}.