API REFERENCE
Images, video & audio
Generate media with your Tokely API key and account balance.
One key and balance
Use https://api.tokely.me/v1 and the same Bearer API key as text generation. GET /v1/models returns enabled model IDs. Check the model page for supported endpoints. Each model has its own parameters and published rates.
| Endpoint | Result |
|---|---|
| POST /v1/images/generations | One image as b64_json or a signed URL valid for 7 days. |
| POST /v1/audio/speech | WAV audio for supported TTS models. |
| POST /v1/media/tasks | 202 with a task_id for video, speech or music. |
| GET /v1/media/tasks/{id} | Task status and progress. |
| GET /v1/media/tasks/{id}/artifacts | Available result files after SUCCESS. |
| GET /v1/media/tasks/{id}/artifacts/{key}/content | Authenticated result file, kept for 30 days. |
Generate an image
Send a prompt and an enabled image model. One image is generated per request (n=1). Results may be returned as a public HTTPS URL or base64 in b64_json.
curl https://api.tokely.me/v1/images/generations \
-H "Authorization: Bearer $TOKELY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini-2.5-flash-image","prompt":"A blue cup on white","n":1}'Synthesize speech
Use input for the text to speak. gemini-3.1-flash-tts-preview supports up to 80 characters and the voices Kore, Zephyr and Puck. This endpoint returns WAV; set response_format to wav or omit it. X-Tokely-Task-ID identifies the underlying task.
Speech submits one task and waits up to three minutes for its result. A timeout does not cancel a submitted generation; inspect its task before submitting again.
curl https://api.tokely.me/v1/audio/speech \
-H "Authorization: Bearer $TOKELY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini-3.1-flash-tts-preview","input":"Hello from Tokely.","voice":"Kore","response_format":"wav"}' \
--output speech.wavGenerate a video task
Video uses the asynchronous media task API. grok-imagine-video-1.5-preview requires one public HTTPS reference image, a motion prompt, a duration of 1–15 seconds and 480p resolution. A successful submission returns 202 and a task_id.
curl https://api.tokely.me/v1/media/tasks \
-H "Authorization: Bearer $TOKELY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"grok-imagine-video-1.5-preview","prompt":"Slow camera zoom","reference_urls":["https://tokely.me/apple-touch-icon.png"],"duration":2,"resolution":"480p"}'Retrieve a task result
Poll the task with the same owner's key until SUCCESS or FAILURE. After SUCCESS, list artifacts and download the returned content_url using your Bearer key. Use the api.tokely.me host for relative content URLs.
Results are stored for 30 days after the task completes. After that, the content endpoint returns 404. Download results you need to keep.
Polling and downloading read the existing task. They do not submit another generation. Avoid automatically retrying a submission after a timeout, since the service may already have started paid work.
curl "https://api.tokely.me/v1/media/tasks/$TASK_ID" -H "Authorization: Bearer $TOKELY_API_KEY"
curl "https://api.tokely.me/v1/media/tasks/$TASK_ID/artifacts" -H "Authorization: Bearer $TOKELY_API_KEY"
curl "https://api.tokely.me/v1/media/tasks/$TASK_ID/artifacts/video/content" -H "Authorization: Bearer $TOKELY_API_KEY" --output video.mp4