Beta

This API is in beta. Endpoints, request/response formats, and behavior may change without notice.

API Reference

Terramind Documentation

Video Endpoints

POST /api/v1/studio/video/generate

Generate a video from a text prompt. Supports text-to-video, image-to-video, and reference-guided generation depending on the model.

Request Body

promptstringrequired

Video description (1–4000 characters).

modelstringrequired

Model: veo, veo-fast, kling-3.0-std, kling-3.0-pro, kling-3.0-4k, wan-2.6, wan-2.7, seedance-2.0, seedance-2.5, grok-video, or grok-video-v1.5.

durationnumber

Duration in seconds (varies by model, default varies).

aspectRatiostring

Aspect ratio: 16:9, 9:16, or 1:1.

resolutionstring

Resolution: 480p, 720p, or 1080p.

imageUrlstring

Image URL for image-to-video generation.

referenceImageUrlstring

Reference image URL (Seedance only).

referenceImagesstring[]

Reference images for Kling 3.0 reference-to-video — up to 4 (std/pro) or 7 (4k). The first image is the start frame.

endImageUrlstring

End frame image URL (Kling 3.0 image-to-video and WAN 2.7 image-to-video).

sourceVideoUrlstring

Source video to transform (WAN 2.7 edit-video only).

audioUrlstring

Audio track to condition output on (WAN 2.7 only).

referenceVideosstring[]

Multi-video references — WAN 2.7 reference-to-video (≤3) and Seedance reference-to-video (token-mapped, ≤3).

negativePromptstring

Negative prompt to avoid certain elements.

generateAudioboolean

Generate audio along with the video.

cfgScalenumber

Classifier-free guidance scale (Kling only, 0–1, default 0.5).

shotTypestring

Kling 3.0 only — customize (default) or intelligent.

seednumber

Seed for reproducibility.

Models

ModelProviderFeatures
veoGoogleText-to-video, image-to-video, up to 8s
veo-fastGoogleFaster generation, lower quality
kling-3.0-stdKuaishouT2V, I2V, end-frame, audio, 3–15s
kling-3.0-proKuaishouT2V, I2V, end-frame, audio, 3–15s
kling-3.0-4kKuaishouT2V, I2V, 4K output, end-frame, audio, 3–15s
wan-2.6AlibabaText-to-video, image-to-video, up to 5s
wan-2.7AlibabaText/image/reference/edit-video, 3–10s, 720p/1080p, optional audio track
seedance-2.5ByteDanceText/image/reference-to-video, 4–30s, 480p/720p/1080p, native audio; takes photoreal faces in references
seedance-2.0ByteDanceText-to-video, reference-guided, up to 10s
seedance-2.0-fastByteDanceFaster/cheaper Seedance, text/image/reference-to-video, up to 10s
pixverse-v6PixverseText-to-video, image-to-video, 5/8s, up to 1080p
grok-videoxAIText-to-video, up to 10s
grok-video-v1.5xAIImage-to-video only (requires imageUrl), 480p/720p, up to 10s

Example

curl
curl -X POST https://terramind.com/api/v1/studio/video/generate \
  -H "Authorization: Bearer sk-tm-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A drone flying over a tropical island at sunset",
    "model": "veo",
    "duration": 5,
    "aspectRatio": "16:9"
  }'

Response

JSON
{
  "success": true,
  "data": {
    "url": "https://storage.googleapis.com/...",
    "storagePath": "studios/.../video.mp4",
    "format": "mp4",
    "duration": 5000,
    "model": "veo",
    "metadata": {
      "aspectRatio": "16:9",
      "enhancedPrompt": "A cinematic drone shot..."
    }
  },
  "credits": { "used": 1, "cost": 25.0, "remaining": 9975.0 }
}

POST /api/v1/studio/video/remove-background

Remove the background from a video using fal.ai VEED. Three variants: standard (best quality), fast (cheaper), and green-screen (replace the background with a solid color).

Request Body

videoUrlstringrequired

URL of the input video.

durationSecondsnumberrequired

Duration of the source video in seconds — used for billing.

variantstring

standard (default), fast, or green-screen.

backgroundColorstring

Hex/named color (green-screen only). Defaults to green.

persistToStorageboolean

Re-upload the result to Terramind storage (default true).

Example

curl
curl -X POST https://terramind.com/api/v1/studio/video/remove-background \
  -H "Authorization: Bearer sk-tm-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "videoUrl": "https://...mp4",
    "durationSeconds": 8,
    "variant": "standard"
  }'

POST /api/v1/studio/video/upscale

Upscale a video to a higher resolution using fal.ai Topaz. Optionally interpolate to a higher target frame rate for smoother motion.

Request Body

videoUrlstringrequired

URL of the input video.

durationSecondsnumberrequired

Duration of the source video in seconds — used for billing.

upscaleFactornumber

2 (default) or 4. 4x is significantly more expensive.

targetFpsnumber

Optional target frame rate: 24, 30, 48, or 60.

persistToStorageboolean

Re-upload the result to Terramind storage (default true).

Example

curl
curl -X POST https://terramind.com/api/v1/studio/video/upscale \
  -H "Authorization: Bearer sk-tm-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "videoUrl": "https://...mp4",
    "durationSeconds": 8,
    "upscaleFactor": 2,
    "targetFps": 60
  }'

Providers & Pricing

A model can run on more than one provider (fal, Atlas Cloud, the Vercel AI Gateway). You name the model; each call runs on the cheapest provider that can serve it, at that provider's list price × 1.28, and falls back to the next one if the provider fails or refuses. An error in your request is returned, not retried elsewhere. The reservation is held at the most expensive eligible provider and the call is charged at the one that ran; the rest is released. Quotes show range.min and range.max when providers differ, and responses name the provider in data.provider (or provider on a queued job). Upscaled tiers such as 1080p-esr and 4k-esr appear in a model's params.resolutions in the catalog where a provider offers them. Write references as @Image1, @Video1 and @Audio1 whichever provider runs the call; each is sent its own spelling (Kling 4.0 on Atlas Cloud reads @image_1, WAN and MiniMax read Image 1), and a provider that cannot take the request's references is skipped.

To run on one provider, add transport: "fal", "atlas" or "gateway" (also accepted by /api/v1/studio/estimate and the batch endpoint). Only that provider is used, nothing falls back, and the call is held and charged at that provider's list price × 1.28, so a quote has no range. If that provider cannot serve the request (the model does not run there, or not this mode, resolution or input) the call returns 400 INVALID_INPUT naming why; if it could but is not available right now, 409 TRANSPORT_UNAVAILABLE. Any other value is a 400. Omit it to let Terramind route the call.

Billing & Credit Reservation

Video generations are expensive, so credits are reserved when the request is accepted and charged only after the video is successfully stored. Any failure along the way (provider error, missing output URL, download or upload failure) releases the reservation automatically and leaves your balance untouched. Webhook-driven deliveries settle the reservation exactly once per job. Insufficient balance returns 402 INSUFFICIENT_CREDITS; hitting the 6-hour usage window returns 429 WINDOW_EXHAUSTED with a resetAt timestamp. See Credit Reservation for details.