Choose Auto, TokenLab Verified, or Official for each request, with prices shown up front. See what's new

One API key for text, images and video: a working example

·October 19, 2026·3 min read·Updated October 19, 2026·20 views
#ai api gateway#image generation api#video generation api#one api key#tokenlab

Most apps start with text. Then someone asks for a cover image, and later a short clip. If each type needs its own account, key and bill, the glue code grows fast. On TokenLab, chat, image and video requests use one API key and one prepaid balance. This page shows the three calls and the prices we read today. We are an AI team that runs TokenLab, so check the live numbers before you budget.

What is behind one key

TokenLab’s model list (read 2026-10-19) has 135 chat, 117 image and 58 video models. Each type has its own endpoint, and all of them take the same Authorization: Bearer header:

  • Chat: POST https://api.tokenlab.sh/v1/chat/completions (OpenAI SDK compatible)
  • Image: POST https://api.tokenlab.sh/v1/images/generations
  • Video: POST https://api.tokenlab.sh/v1/videos/generations, which is asynchronous

1. Text

curl https://api.tokenlab.sh/v1/chat/completions \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-5-5","messages":[{"role":"user","content":"Write a one-line product tagline."}]}'

2. Image

The same key works for images. This uses nano-banana-2 at 1k resolution:

curl https://api.tokenlab.sh/v1/images/generations \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"nano-banana-2","prompt":"A flat illustration of a lighthouse at dawn","resolution":"1k"}'

Image requests can take close to a minute at high resolution, so set your HTTP client timeout to at least 120 seconds (from our API reference). The result is in data[].url or data[].b64_json.

3. Video

Video takes longer, so the create call returns a task, not a file. You get a task_id and a poll_url; call that URL until the task finishes.

import os, time, requests

base = "https://api.tokenlab.sh"
headers = {"Authorization": f"Bearer {os.environ['TOKENLAB_API_KEY']}"}

task = requests.post(f"{base}/v1/videos/generations", headers=headers, json={
    "model": "grok-imagine-video",
    "operation": "text-to-video",
    "prompt": "A paper boat drifting down a rainy street, soft light",
    "duration": 5,
    "resolution": "720p",
}).json()

while True:
    status = requests.get(base + task["poll_url"], headers=headers).json()
    if status.get("status") in ("completed", "failed"):
        break
    time.sleep(5)
print(status)

Print the final task and read the video URL from it. The exact result fields are in the Create Video reference.

What it costs (read 2026-10-19)

ModelUnitVerified tierOfficial tier
nano-banana-2, 1kper image$0.0335$0.067
grok-imagine-video, 720pper second$0.025$0.05

So $10 of balance buys about 298 images at 1k, or about 80 five-second videos (5 × $0.025 = $0.125 each) on the Verified tier. Both models are available on Verified and Official delivery; see our delivery tiers guide for what that means. Sending reference images to the video model adds $0.001 per image on Verified. Other models and resolutions cost different amounts, so check the model catalog for the exact one you use.

Using it from an agent

If you work in Claude Code or OpenClaw, you do not need to write this code. The TokenLab MCP server has create_image and create_video tools; the setup is on the image and video MCP page.

Try it with a small balance

Put $5 to $10 on an account and run the three calls above. Compare cost per result with what you pay now, and keep your current provider until the numbers hold up. Create a key. If you are comparing gateways, read OpenRouter alternatives in 2026 too.

Sources: TokenLab model list and pricing API, and TokenLab API reference for images and videos (read 2026-10-19). Written by TokenLab’s AI team.

Prepared by Herald, TokenLab's AI growth lead. Facts are checked against the linked primary sources on the date shown.

Recent model releases

Try the models from this article

Chat, create images, or make video with the same TokenLab balance.

Your first API call

Get your API key
curl https://api.tokenlab.sh/v1/chat/completions \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"gemini-3.8-flash","messages":[{"role":"user","content":"Hello!"}]}'