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.

EndpointResult
POST /v1/images/generationsOne image as b64_json or a signed URL valid for 7 days.
POST /v1/audio/speechWAV audio for supported TTS models.
POST /v1/media/tasks202 with a task_id for video, speech or music.
GET /v1/media/tasks/{id}Task status and progress.
GET /v1/media/tasks/{id}/artifactsAvailable result files after SUCCESS.
GET /v1/media/tasks/{id}/artifacts/{key}/contentAuthenticated 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.wav

Generate 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

EXPLORE DOCUMENTATION

IntroductionConnect your app to AI models through one familiar API. This is your guide to building with Tokely.QuickstartMake your first Tokely request in three steps.API keysConnect securely with a key from your Tokely dashboard.ModelsChoose an available model and use its exact ID in your request.PlaygroundUse the Tokely Playground to test prompts before writing code.Use your existing appConnect an existing OpenAI-compatible application to Tokely.Chat CompletionsGenerate responses from text messages and supported inline images or PDFs.ResponsesUse stateless text and supported multimodal input with the Responses API.EmbeddingsTurn text into vectors for search, RAG, clustering and classification with the OpenAI-compatible /v1/embeddings endpoint.Claude Code and the Messages APIPoint Claude Code or the Anthropic SDK at Tokely. Use the native /v1/messages endpoint with streaming, tools and prompt caching.Images and PDFsSend inline images and PDFs to compatible models through Chat Completions or Responses.Images, video & audioGenerate media with your Tokely API key and account balance.Errors & limitsDiagnose failed requests and keep your integration within service limits.StreamingDisplay generated text as it arrives with server-sent events.Function callingLet a model request a function, then execute it in your application.Structured outputRequest JSON output or a defined schema from a compatible model.Usage & billingModel prices, account balance and output reservations.WebhooksTokely webhook events, HMAC signature verification, delivery retries and replay behavior.
Use Tab to browse results ESC to close