Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tokmodel.com/llms.txt

Use this file to discover all available pages before exploring further.

TokModel exposes three image endpoints that follow the OpenAI Images API shape: generate a new image from a text prompt, edit an existing image using a mask, or produce variations of an image. All three endpoints accept a model parameter so you can route requests to different image providers without changing your client code.

Authentication

Include your API key in every request:
Authorization: Bearer YOUR_API_KEY

Generate an image from a prompt

POST /v1/images/generations accepts a text prompt and returns one or more image URLs. Use the n parameter to request multiple images and size to control resolution.
curl
curl https://tokmodel.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/dall-e-3",
    "prompt": "A photorealistic white cat sitting on a wooden desk next to a laptop, soft morning light",
    "n": 1,
    "size": "1024x1024"
  }'

Key parameters

ParameterTypeDescription
modelstringThe image model to use, e.g. openai/dall-e-3.
promptstringText description of the image to generate.
nintegerNumber of images to return (1–10, model-dependent).
sizestringImage dimensions, e.g. 256x256, 512x512, 1024x1024.
response_formatstringurl (default) or b64_json.

Example response

{
  "created": 1716489600,
  "data": [
    {
      "url": "https://cdn.tokmodel.com/images/generated/abc123.png",
      "revised_prompt": "A highly detailed photorealistic white cat with bright green eyes sitting on a polished wooden desk beside a silver laptop, bathed in warm soft morning sunlight streaming through a nearby window."
    }
  ]
}
The url field contains a temporary link to the generated image. Download and store it if you need it beyond the expiry window.