This page is written for OpenClaw and other agents that need a direct, repeatable path to create media with KiwiWhale.
POST /api/v1/agent_register.php.GET /api/v1/models.php.z-image.POST /api/v1/generate.php.GET /api/v1/jobs.php?job_id=... until complete.outputs[0].url and use the generated image.Agents can discover KiwiWhale here:
Human uses browser login. Hybrid uses a human-owned account with an API key. Agent uses API-key-native access and can run autonomous top-up after payment method setup.
For agent and hybrid use, send the API key as a Bearer token:
Authorization: Bearer YOUR_API_KEY
Human browser sessions use normal site login and cookies.
Endpoint:
POST /api/v1/agent_register.php
Example request body:
{
"name": "My Agent"
}
Example response:
{
"success": true,
"account_type": "agent",
"user_id": 123,
"api_key": "kw_...",
"credits": 0
}
Important: save the api_key. The agent will need it for all later calls.
Endpoint:
GET /api/v1/credits.php
Example response:
{
"credits": 0,
"account_type": "agent"
}
Endpoint:
GET /api/v1/models.php
Agents should use the returned public_model when calling generate.php.
Example response shape:
{
"success": true,
"count": 3,
"models": [
{
"product_id": "z-image",
"public_model": "z-image",
"category": "text-to-image",
"cost_credits": 0.05,
"schema": { ... }
}
]
}
| Public Model | Category | Cost Credits |
|---|---|---|
| ffmpeg-api/merge-audio-video | tools | 0.2000 |
| ffmpeg/extract-frame | tools | 0.4000 |
| ffmpeg/merge-videos | tools | 0.8000 |
| ffmpeg/normalize-compose | tools | 0.8000 |
| gpt-5-mini/chat | chat | 0.0100 |
| gpt-5.5/chat | chat | 0.0500 |
| gpt-image-2/image-edit | image-to-image | 0.4000 |
| gpt-image-2/image-transform | image-to-image | 0.3165 |
| gpt-image-2/text-to-image | text-to-image | 0.2000 |
| kiwiwhale/audio-analysis | tools | 0.0500 |
| kiwiwhale/s2-pro/tts | text-to-audio | 0.0500 |
| kiwiwhale/seedance-2.0-fast | image-to-video | 1.1250 |
| kiwiwhale/upload | tools | 0.0000 |
| kling-v1/ai-multi-shot | image-to-image | 0.8000 |
| seedance-2.0/reference-to-video | image-to-video | 1.4900 |
| seedvr/upscale/image | tools | 0.0500 |
| tools/web-search | tools | 0.0500 |
| wan-2.1/text-to-image | text-to-image | 0.0600 |
| z-image/turbo | text-to-image | 0.0200 |
Endpoint:
POST /api/v1/generate.php
Minimal text-to-image example:
{
"model": "z-image",
"prompt": "a realistic dog sitting in a park"
}
Example success response:
{
"status": "queued",
"job_id": "abc123",
"auto_topup_applied": false,
"auto_topup_message": ""
}
Generation is asynchronous. A successful submit returns a job_id, not the final image.
Endpoint:
GET /api/v1/jobs.php?job_id=abc123
Example completed response:
{
"status": "completed",
"outputs": [
{
"url": "https://...",
"mime": "image/png"
}
],
"seed": 12345
}
Agents should keep polling until status is one of:
completed, succeeded, success, done, finished
Then use outputs[0].url.
KiwiWhale uses credits as the wallet unit.
auto_topup_applied and auto_topup_message.First-time autonomous payment setup uses these endpoints:
POST /api/v1/agent_setup_payment.php POST /api/v1/agent_confirm_payment_method.php
In practice, the first payment method setup may require browser interaction. After setup, off-session charging can be autonomous.
POST /api/v1/agent_topup.php
{
"credits": 10
}
POST /api/v1/agent_register.php
{
"name": "Dog Image Agent"
}
api_key = "kw_..."
GET /api/v1/models.php Authorization: Bearer kw_...
model = "z-image"
POST /api/v1/generate.php
Authorization: Bearer kw_...
Content-Type: application/json
{
"model": "z-image",
"prompt": "a realistic dog sitting in a park"
}
GET /api/v1/jobs.php?job_id=... Authorization: Bearer kw_...
outputs[0].url
For full first-time autonomous onboarding, an automation agent may:
generate.phpjobs.phpThis is why KiwiWhale also provides automation-friendly pages and selectors for browser agents.
{
"error": "INSUFFICIENT_CREDITS",
"message": "Not enough credits to run this request."
}
{
"error": "payment_method_not_ready",
"message": "No saved off-session payment method is configured."
}
{
"error": "Unknown or inactive model"
}
Agents should treat error codes and messages as part of normal control flow.