Spicy API

Build on top of the Spicy API

Ship text-to-video and text-to-image experiences backed by the Spicy models. Authenticate with API keys, stream progress events, and deliver results in minutes.

Why teams rely on the Spicy API

Deliver resilient video and image generation workflows with streaming progress, optional webhooks, and automatic storage uploads.

Developer-friendly streaming

Receive server-sent events with live status, progress, and final video URLs to keep your UI in sync.

Async webhook support

Provide a webhook endpoint to receive completion payloads without maintaining a long-lived connection.

Transparent billing

Video calls cost 10 credits and image calls cost 5 credits. Failed generations are automatically refunded so you stay in control.

Authentication & Base URL

All endpoints live under https://spicyai.site/api. Supply the API key created in the console via the Authorization header.

  • Send the header Authorization: Bearer YOUR_API_KEY with every request.
  • Use Content-Type: application/json when posting payloads.
  • Video generation deducts 10 credits and image generation deducts 5 credits; failed jobs are refunded automatically.

Core endpoints

Start by creating a generation task for video or image, then poll or listen for the result.

Create Spicy video

Kick off a Spicy generation job with text-to-video or optional image-to-video prompts.

Method: POSTPath: /api/v1/video/create

Payload parameters

  • Required. Use "spicy-2-video" to target the latest Spicy video model.
  • Required. Natural language description of the scene you want the Spicy model to create.
  • Optional. Base64 data URL for image-to-video mode; uploaded to storage automatically.
  • Optional. Supported values: "9:16" (default) or "16:9".
  • Optional. HTTPS endpoint that receives the final result payload when the task succeeds.
  • Optional. Set true in webhook mode to suppress intermediate SSE progress events.

Notes

  • Responses are streamed over Server-Sent Events; keep the connection open and parse progress updates until completion.
  • Provide webHook to receive the final payload asynchronously without polling.

Sample request

curl -X POST https://spicyai.site/api/v1/video/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -N \
  -d '{
    "model": "spicy-2-video",
    "prompt": "A cinematic shot of a futuristic city at sunset, captured in 4K."
  }'

SSE

data: {"id":"task-123","status":"running","progress":45}

data: {"id":"task-123","status":"succeeded","progress":100,"results":[{"url":"https://cdn.example.com/videos/task-123.mp4"}]}

Create Spicy image

Trigger a Spicy image generation job for text-to-image or optional image-to-image refinement.

Method: POSTPath: /api/v1/image/create

Payload parameters

  • Required. Use "spicy-2-image-fast" (Spicy 2 Image Fast) or "spicy-2-image" (Spicy 2 Image).
  • Required. Natural language description of the image you want to create.
  • Optional. Describe elements the model should avoid.
  • Optional. Base64 data URL for image-to-image mode; uploaded to storage automatically.
  • Optional. HTTPS URL for an existing reference image if you prefer not to upload base64 data.
  • Optional. Supported values include "auto", "1:1", "4:5", "3:4", "4:3", "3:2", "16:9", "9:16", "21:9".
  • Optional. Boolean flag to mark the generation as public; defaults to true for free-tier users.

Notes

  • The response returns a task id immediately. Poll the check-result endpoint to retrieve final URLs.
  • Accepts spicy-2-image-fast (Spicy 2 Image Fast) or spicy-2-image (Spicy 2 Image) for the model field.

Sample request

curl -X POST https://spicyai.site/api/v1/image/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "spicy-2-image-fast",
    "prompt": "Ultra detailed portrait of a cyberpunk explorer in neon rain, 8k, dramatic lighting",
    "aspectRatio": "1:1",
    "negativePrompt": "blurry, low quality, watermark"
  }'

Sample response

{
  "code": 0,
  "message": "ok",
  "data": {
    "id": "task-456",
    "is_public": true
  }
}

Check generation result

Poll the latest status for a generation task if you are not listening to the stream or webhook.

Method: POSTPath: /api/video-generations/check-result

Payload parameters

  • Required. The identifier returned when you created the generation task.

Notes

  • The endpoint verifies the task belongs to your account before returning data.
  • Failed jobs return credits automatically and expose refund metadata in the response.

Sample request

curl -X POST https://spicyai.site/api/video-generations/check-result \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "taskId": "task-123"
  }'

Sample response

{
  "code": 0,
  "message": "Success",
  "data": {
    "status": "running",
    "progress": 45,
    "result_url": null,
    "result_urls": [],
    "failure_reason": null,
    "error_message": null,
    "credits_refunded": false
  }
}

1. Create the task

Send the Spicy API request with your prompt and optional webhook URL, then store the returned taskId.

2. Track progress

Subscribe to the streaming events (video) or call the check-result endpoint until the status becomes succeeded or failed.

3. Deliver the video

Use the storage-backed URLs in result_url/result_urls to serve or download the generated video or image.

Frequently asked questions

How do I authenticate my requests?

Create an API key in the console, then include it as Authorization: Bearer YOUR_API_KEY. Keys can be rotated at any time.

What does the streaming response look like?

The endpoint sends Server-Sent Events where each data line is a JSON object containing id, status, progress, and optional results. Parse the event stream until you receive status "succeeded" or "failed".

How are credits handled for failures?

We automatically refund credits when a task fails and return refund_trans_no plus credits_refunded=true in the check-result payload for audit trails.

Helpful resources

Launch with Spicy API today

Create your API key and start generating cinematic AI videos and high-fidelity images in minutes.