TUBKALStudioGet an API key

API reference

One API for the best image and video models. Billed from your Tubkal Studio credits. Generations are asynchronous: create one, then poll it until status is completed or failed. Failed generations are refunded automatically.

Authentication

Send your key in the Authorization header. Limit: 60 requests per minute per key.

Authorization: Bearer sk_live_…

Create an image

curl -X POST https://tubkalstudio.ai/api/v1/images \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{
    "prompt": "argan oil bottle on a wooden table in a Marrakech riad, morning light",
    "model": "nano-banana-pro",        // GET /models for the list
    "aspect_ratio": "4:5",              // 1:1 | 4:5 | 9:16 | 16:9
    "num_images": 1,                    // 1-4
    "reference_image_url": null,        // optional, Pro models
    "enhance": true                     // rewrite the prompt (any language → pro English)
  }'

Response 202:

{ "id": "…", "type": "image", "status": "running", "outputs": [], "credits_used": 8, … }

Create a video

curl -X POST https://tubkalstudio.ai/api/v1/videos \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{
    "prompt": "tea poured in slow motion on a rooftop in Marrakech at sunset",
    "model": "kling-3-pro",
    "duration": 5,                      // seconds, see model durations
    "aspect_ratio": "9:16",             // text-to-video only
    "image_url": null,                  // set it for image-to-video
    "end_image_url": null,              // optional last frame
    "camera": "orbit",                  // auto | static | dolly_in | dolly_out | orbit | crane | tracking | handheld | fpv | zoom
    "style": "cinematic"                // auto | cinematic | commercial | ugc | realistic | anime | game
  }'

Get a generation

curl https://tubkalstudio.ai/api/v1/generations/{id} -H "Authorization: Bearer $API_KEY"

{ "id": "…", "status": "completed", "outputs": ["https://…/0.mp4"], "credits_used": 30, … }

Images take a few seconds, videos 1-3 minutes. Poll every 3-5 seconds.

Models & balance

curl https://tubkalstudio.ai/api/v1/models  -H "Authorization: Bearer $API_KEY"
curl https://tubkalstudio.ai/api/v1/balance -H "Authorization: Bearer $API_KEY"

Video models are billed per second (credits × duration), image models per image.

Errors

{ "error": { "code": "insufficient_credits" } }

401 invalid_api_key · 402 insufficient_credits · 403 plan_duration · 422 blocked_content
429 rate_limited · 400 invalid_prompt | invalid_model | invalid_duration | invalid_aspect_ratio

MCP (Claude and other AI assistants)

Remote MCP server over HTTP. Tools: generate_image, generate_video, get_generation, list_models, get_balance.

URL:    https://tubkalstudio.ai/api/mcp
Header: Authorization: Bearer sk_live_…