RazrAi.com logo

RazrAi.com

Uncen • New • ZeroRisk

Login
PricingAPI DocsPrompts
LoginRegister

RazrAi API

OpenAI compatible API for generating images.

The copied guide includes the base URL, authentication, image/video requests, upload limits, polling, idempotency, error handling, and an acceptance checklist for AI coding assistants.

AuthModelsImagesVideosErrors

Base URL

https://razrai.com/v1

If you are using a different domain, replace it with your site domain.

Authentication

Use your API key from Account → API.

Authorization: Bearer razrai_sk-...

GET /models

Default model: razrai-v4

Lists the models available to this API key. OpenAI clients use the plural /models endpoint.

curl "https://razrai.com/v1/models" \
  -H "Authorization: Bearer <YOUR_API_KEY>"

Response (JSON)

{
  "object": "list",
  "data": [
    {
      "id": "razrai-v4",
      "object": "model",
      "created": 1767225600,
      "owned_by": "razrai"
    }
  ]
}

POST /images/generations

Compatible with OpenAI Images API (response_format=url).

cURL
curl "https://razrai.com/v1/images/generations" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"model":"razrai-v4","prompt":"A modern poster for razrai.com","size":"1024x1024","n":1,"response_format":"url","watermark":false}'

Request (JSON)

{
  "model": "razrai-v4",
  "prompt": "A modern poster for razrai.com",
  "size": "1024x1024",
  "n": 1,
  "response_format": "url",
  "watermark": false
}

The model field is optional. If omitted, razrai-v4 is used.

Optional extensions: negative_prompt (string), seed (non-negative integer), workflow_id (string), and watermark (boolean, defaults to true). Image size defaults to 1024x1024; n must be 1 and response_format must be url.

Response (JSON)

{
  "created": 1730000000,
  "data": [
    {
      "url": "https://.../uploads/...png"
    }
  ],
  "record_id": "...",
  "expires_at": null
}

record_id is a RazrAi extension for tracing the internal generation record.

Download directly from data[0].url. expires_at is the R2 file's expiration time in Unix seconds. Server files return null and follow the site's cleanup policy.

GET /images/{record_id}/content

Use the record_id from the generation response and an API key for the same account. Server files are returned directly. R2 files return a 307 redirect to a fresh signed URL.

curl --fail --location "https://razrai.com/v1/images/<RECORD_ID>/content" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  --output generated-image.png

POST /videos

OpenAI-compatible video tasks. Images and audio are optional. Reference media must be uploaded as multipart files; URLs, base64, and file_id are not accepted.

Upload limits: up to 4 images and 2 audio files; every file must be 800 KB (819,200 bytes) or smaller. Compress files client-side before calling the API. Oversized uploads return HTTP 413 with the required target size.

Video generation request

Images and audio are optional. Choose your language; the image example shows how to attach one reference file.

cURL
curl -X POST "https://razrai.com/v1/videos" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -F "prompt=A cinematic sunrise over a quiet ocean" \
  -F "seconds=10" \
  -F "aspect_ratio=16:9 (Widescreen)" \
  -F "megapixels=0.6" \
  -F "super_resolution=false"

# Optional reference image:
curl -X POST "https://razrai.com/v1/videos" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -F "prompt=Animate this reference image with a slow camera move" \
  -F "seconds=10" \
  -F "aspect_ratio=16:9 (Widescreen)" \
  -F "megapixels=0.6" \
  -F "super_resolution=false" \
  -F "[email protected]"

For regular HTTP requests, send aspect_ratio and megapixels directly to control framing, quality, and point cost precisely.

Direct OpenAI SDK usage

Point the SDK base_url/baseURL to the API Base URL above and reuse the same API key. The SDK size field is only a compatibility field and is converted to the nearest aspect ratio and quality. Prefer aspect_ratio and megapixels for regular HTTP requests. input_reference is the compatible file alias; use images for additional files.

Python SDK
from openai import OpenAI

client = OpenAI(api_key="<YOUR_API_KEY>", base_url="https://razrai.com/v1")
video = client.videos.create(
    model="sora-2",
    prompt="A cinematic sunrise over a quiet ocean",
    seconds="8",
    size="1280x720",
    # Optional: input_reference=open("compressed-reference.jpg", "rb")
)
print(video.id)

Request fields

{
  "prompt": "Animate this reference image with a slow camera move",
  "seconds": 10,
  "aspect_ratio": "16:9 (Widescreen)",
  "megapixels": 0.6,
  "super_resolution": false,
  "images": "optional multipart file field"
}
FieldRequirement
promptRequired, 1-4000 characters.
modelOptional; accepts an OpenAI SDK model alias and echoes it in the response.
secondsOptional: 5, 8, 10, 12, or 15; live administrator settings determine availability.
aspect_ratioRecommended; directly selects a tool-supported aspect ratio, such as 16:9 (Widescreen).
megapixelsRecommended: 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.5, or 2; controls quality and point cost and is constrained by live settings and configured duration prices.
sizeOptional OpenAI SDK compatibility field: 720x1280, 1280x720, 1024x1792, or 1792x1024. When used alone, it is converted to the nearest aspect_ratio and megapixels; explicit fields take precedence.
super_resolutionOptional boolean; true returns 400 while disabled by the administrator.
input_reference / imagesOptional files; at most 1 input_reference, 4 images total, and 800 KB per file.
audiosOptional files, at most 2, and 800 KB per file.
client_request_idOptional idempotency key, 8-100 characters.

aspect_ratio, seconds, megapixels, and super_resolution follow the tool workflow and the administrator's live availability and point settings. Disabled values return 400 with valid choices in error.supportedValues and error.suggestedValue.

Compress an image below 800 KB

These examples progressively lower JPEG quality. If the result is still too large, reduce its dimensions as well. Re-check the byte size before sending. Audio must also be compressed by the caller to 800 KB or less.

Python / Pillow
from io import BytesIO
from PIL import Image

image = Image.open("reference.png").convert("RGB")
for quality in range(85, 29, -5):
    output = BytesIO()
    image.thumbnail((1280, 1280))
    image.save(output, "JPEG", quality=quality, optimize=True)
    if output.tell() <= 800 * 1024:
        open("compressed-reference.jpg", "wb").write(output.getvalue())
        break
else:
    raise ValueError("Image is still larger than 800 KB")

GET /videos/{video_id}

Poll until status is completed. Failed tasks include a specific error value.

curl "https://razrai.com/v1/videos/<VIDEO_ID>" \
  -H "Authorization: Bearer <YOUR_API_KEY>"

GET /videos/{video_id}/content

After completion, request this endpoint with your API key. Server files are returned directly. R2 files return a 307 redirect. Follow the redirect and send the API key only to the API host. The task's expires_at gives the R2 file's expiration time in Unix seconds.

curl --fail --location "https://razrai.com/v1/videos/<VIDEO_ID>/content" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  --output generated-video.mp4

Response (JSON)

{
  "id": "video_...",
  "object": "video",
  "status": "queued",
  "progress": 0,
  "seconds": "10",
  "size": "1280x720",
  "expires_at": null,
  "video_url": null
}

Error behavior

The API distinguishes unavailable parameters, unsupported combinations, oversized files, insufficient points, concurrency/quota limits, and task failures. Read error.code, error.message, supportedValues, suggestedValue, requiredPoints, availablePoints, and request_id to diagnose and fix the request.

400 - duration_unavailable

{
  "error": {
    "message": "Selected duration option is unavailable",
    "type": "invalid_request_error",
    "code": "duration_unavailable",
    "param": "seconds",
    "value": 10,
    "supportedValues": [
      "5",
      "8"
    ],
    "suggestedValue": "5",
    "request_id": "..."
  }
}

413 - file_too_large

{
  "error": {
    "message": "Each image or audio file must be 800 KB or smaller",
    "type": "invalid_request_error",
    "code": "file_too_large",
    "maxBytes": 819200,
    "maxSize": "800 KB",
    "suggestion": "Compress each image or audio file to 800 KB or less before uploading.",
    "request_id": "..."
  }
}

402 - insufficient_points

{
  "error": {
    "message": "Insufficient points",
    "type": "invalid_request_error",
    "code": "insufficient_points",
    "requiredPoints": 4000,
    "availablePoints": 1200,
    "suggestion": "Add points to your account and retry the video generation request.",
    "request_id": "..."
  }
}

File download errors

  • 404 means the record is missing, belongs to another account, or its file is unavailable. See image_not_found, video_not_found, image_file_unavailable, and video_file_unavailable.
  • 409 means the result is not ready for download. Poll the video task status and stop if the task fails.
  • 410 means the R2 file has expired. See image_expired and video_expired.
  • 502 means storage could not be accessed. Retry the download later without regenerating the file.
RazrAi.com

RazrAi.com

Create - Invite - Earn

AI tool platform with image generation, video workflows, private work records, and flexible deployment.

© 2026 RazrAi. All rights reserved.

Privacy PolicyTerms of ServiceRefund PolicyAPI DocsNewsroom
YouTubeX / Twitter