Amanai Docs

Media

Image, video, speech, transcription, segmentation, file, and artifact contracts.

Overview

Media endpoints use the same Amanai Bearer key and https://api.amanai.sh/v1 base URL as chat, but each modality has its own input validation, output delivery, and billing unit. Endpoints share an operation shape; supported controls vary by model. Select a compatible model and send only the fields it supports.

Realtime is separate. WebRTC voice and WebSocket audio have a dedicated Realtime guide. Text vectors and ranking are documented under Embeddings and Rerank.

Models and endpoints

CapabilityEndpointModels
Image generationPOST /v1/images/generationsPublished image models
Image editingPOST /v1/images/editsGrok Imagine image models and Muse Image 1.0
VideoPOST /v1/videosGrok Imagine video models
Speech synthesisPOST /v1/audio/speechSpeech synthesis models
TranscriptionPOST /v1/audio/transcriptionsGrok Voice Transcribe models and Muse transcription
FilesPOST /v1/filesOwner-scoped input for media operations
Image conversationPOST /v1/responses Muse Image 1.0 amanai/muse-image-1.0
SegmentationPOST /v1/segmentations SAM 3.1 amanai/sam-3.1

Current rates for every model are centralized in Billing & pricing.

SAM accepts a private file_id, an object description in prompt, and media_kind set to image or video. Optional mask_encoding is one_bit or lossless. Retrieve completed masks from GET /v1/segmentations/{id}/content.

Image generation and editing

ModelOperationsOutput
GPT 5.6 Luna Image amanai/gpt-5.6-luna-image GenerateOne verified image artifact
GPT 5.6 Sol Image amanai/gpt-5.6-sol-image GenerateOne verified image artifact
GPT 5.6 Terra Image amanai/gpt-5.6-terra-image GenerateOne verified image artifact
Grok Imagine Image amanai/grok-imagine-image Generate, EditOne verified image artifact
Grok Imagine Image 2.0 amanai/grok-imagine-image-2.0 Generate, EditOne verified image artifact
Muse Image 1.0 amanai/muse-image-1.0 Generate, Edit, Responses1–10 images; PNG, JPEG, WebP

GPT image models support 1024x1024, 1536x1024, or 1024x1536 with auto, low, medium, or high quality. The legacy Grok Imagine model remains fixed at 1024x1024. Grok Imagine Image 2.0 accepts aspect_ratio (auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, 19.5:9, 9:19.5, 20:9, 9:20, 21:9, or 5:2) and resolution (1k or 2k), with auto, low, or medium quality. For Image 2.0, quality=auto uses low for generation and medium for editing. Send aspect_ratio and resolution instead of the legacy square size hint.

bash
curl https://api.amanai.sh/v1/images/generations \
  -H "Authorization: Bearer $AMANAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: image-demo-001" \
  -d '{
    "model": "amanai/grok-imagine-image-2.0",
    "prompt": "A cinematic observatory above a sea of clouds",
    "aspect_ratio": "16:9",
    "resolution": "2k",
    "quality": "auto",
    "n": 1,
    "output_format": "png"
  }'

Editing accepts multipart image input or private image_file_ids with a required prompt. Grok Imagine accepts one source image, Image 2.0 accepts up to five, and Muse Image 1.0 accepts up to ten. Muse supports n from 1 to 10 and PNG, JPEG, or WebP output. Muse also supports image generation and continuation through POST /v1/responses with previous_response_id.

bash
curl https://api.amanai.sh/v1/images/edits \
  -H "Authorization: Bearer $AMANAI_API_KEY" \
  -H "Idempotency-Key: image-edit-demo-001" \
  -F "model=amanai/grok-imagine-image-2.0" \
  -F "prompt=Replace the daytime sky with a clear night sky" \
  -F "image=@photo.png" \
  -F "aspect_ratio=3:2" \
  -F "resolution=1k" \
  -F "output_format=png"

output_format=png in these examples is an OpenAI-compatibility hint, not a promise about the delivered encoding. The response reports the verified output_format and exact pixel size of the delivered bytes. Grok may return JPEG, PNG, or WebP; use the response metadata or HTTP content type when naming a download.

Video generation

ModelInputsDurationSize
Grok Imagine Video amanai/grok-imagine-video Text, optional source image1–15 seconds480x854, 854x480, 720x1280, 1280x720
Grok Imagine Video 1.5 amanai/grok-imagine-video-1.5 Text, optional source image1–15 seconds480x854, 854x480, 720x1280, 1280x720, 1080x1920, 1920x1080
Grok Imagine Video 1.5 Lite amanai/grok-imagine-video-1.5-lite Text, optional source image1–15 seconds480x854, 854x480, 720x1280, 1280x720, 1080x1920, 1920x1080

Video is a durable asynchronous job. Submit once with a unique idempotency key, poll the returned job, then download the artifact URL returned by the completed job.

bash
VIDEO=$(curl -sS https://api.amanai.sh/v1/videos \
  -H "Authorization: Bearer $AMANAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: video-demo-001" \
  -d '{
    "model": "amanai/grok-imagine-video-1.5",
    "prompt": "A paper spaceship crossing a watercolor sky",
    "seconds": "4",
    "size": "720x1280"
  }')

VIDEO_ID=$(printf '%s' "$VIDEO" | jq -r .id)
curl https://api.amanai.sh/v1/videos/$VIDEO_ID \
  -H "Authorization: Bearer $AMANAI_API_KEY"

For image-to-video, submit a source image with multipart data or input_reference.file_id. Grok Video supports edit and extension endpoints; Video 1.5 supports additional reference images, a last frame, keyframes, and preset voices. Video 1.5 Lite supports an optional source image. The job state is queued, in_progress, completed, or failed. Poll no faster than OpenAI-Poll-After-Ms.

Speech synthesis

ModelVoicesFormatsSpeed
Grok Voice TTS amanai/grok-voice-tts 28 built-in voicesMP3, WAV0.7–1.5

Speech synthesis defaults to eve. Built-in voices are carina, zagan, helix, orion, luna, iris, altair, zenith, perseus, helios, lux, kepler, rigel, cosmo, celeste, ursa, sirius, lumen, castor, naksh, atlas, aurora, liora, ara, eve, leo, rex, sal. Language accepts auto, one of the published presets, or another bounded BCP-47 tag. Indonesian uses id-ID; Malay uses ms-MY.

bash
curl https://api.amanai.sh/v1/audio/speech \
  -H "Authorization: Bearer $AMANAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: speech-demo-001" \
  -d '{
    "model": "amanai/grok-voice-tts",
    "input": "Welcome to Amanai.",
    "voice": "eve",
    "language": "en-US",
    "response_format": "mp3",
    "speed": 1.0
  }' --output speech.mp3

Published presets: Auto detect (auto), English (US) (en-US), English (UK) (en-GB), Indonesian (id-ID), Malay (ms-MY), Arabic (ar-SA), Czech (cs-CZ), Danish (da-DK), Dutch (nl-NL), Filipino (fil-PH), Chinese (Simplified) (zh-CN), Japanese (ja-JP), Korean (ko-KR), Spanish (es-ES), French (fr-FR), German (de-DE), Italian (it-IT), Macedonian (mk-MK), Persian (fa-IR), Polish (pl-PL), Portuguese (Brazil) (pt-BR), Romanian (ro-RO), Russian (ru-RU), Swedish (sv-SE), Thai (th-TH), Turkish (tr-TR), Vietnamese (vi-VN), Hindi (hi-IN).

Speech transcription

ModelInputResponse formats
Grok Voice Transcribe 1.0 amanai/grok-voice-transcribe-1.0 One audio file up to 20 MiBjson, text, verbose_json
Grok Voice Transcribe 2.0 amanai/grok-voice-transcribe-2.0 One audio file up to 20 MiBjson, text, verbose_json, diarized_json
Muse Voice Transcribe 1.0 amanai/muse-voice-transcribe-1.0 One audio file up to 20 MiBjson, text, verbose_json, diarized_json

Accepted formats are MP3, MP4/M4A, WAV, OGG, FLAC, AAC, and Opus. The optional language hint uses a short code such as id or ms. Grok Transcribe 2.0 supports speaker diarization and word timestamps. Muse supports recognition modes and keyword hints. Both support diarized_json; realtime transcription uses the WebSocket contract in the Realtime guide. Prompt, temperature, and translation are not accepted.

bash
curl https://api.amanai.sh/v1/audio/transcriptions \
  -H "Authorization: Bearer $AMANAI_API_KEY" \
  -H "Idempotency-Key: transcript-demo-001" \
  -F "file=@recording.wav" \
  -F "model=amanai/grok-voice-transcribe-2.0" \
  -F "language=id" \
  -F "response_format=verbose_json"

Language hints: Auto detect, Arabic (ar), Czech (cs), Danish (da), Dutch (nl), English (en), Filipino (fil), French (fr), German (de), Hindi (hi), Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Macedonian (mk), Malay (ms), Persian (fa), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Spanish (es), Swedish (sv), Thai (th), Turkish (tr), Vietnamese (vi).

Files and artifacts

Multipart image edits, video inputs, and transcription requests automatically stage their inputs. Use POST /v1/files when you need a reusable private file ID. Files are scoped to the authenticated owner and limited to 100 MiB.

bash
curl https://api.amanai.sh/v1/files \
  -H "Authorization: Bearer $AMANAI_API_KEY" \
  -H "Idempotency-Key: file-demo-001" \
  -F "purpose=user_data" \
  -F "file=@recording.wav"

Inspect, download, or delete with GET /v1/files/{id}, GET /v1/files/{id}/content, and DELETE /v1/files/{id}. Generated artifacts use expiring /v1/artifacts/download/{token} URLs; download results you intend to keep.

Retries and ownership

✓Use one unique Idempotency-Key for each logical media operation.
✓Retry the exact same body with the same key after a network failure.
✓Reusing a key for different input returns 409 idempotency_conflict.
✓Files, jobs, and artifacts are owner-bound and cannot cross accounts.
✓A failure before usable output is delivered is refunded; durable jobs settle or refund exactly once.