Quickstart
One key, one base URL, every model. Media tasks run asynchronously; chat models answer directly in the OpenAI or Anthropic format.
https://api.tapmodels.com/v1
Authentication
Send your API key as a bearer token on every request. Create and revoke keys on the keys page; each key can carry a spend limit and a list of allowed models. The secret is shown once, so store it in an environment variable, not in code.
curl https://api.tapmodels.com/v1/balance \
-H "Authorization: Bearer $TAPMODELS_API_KEY"
# {"credits": 1834.2}Your first task
Image, video and audio models run as tasks. Submit one with POST /tasks: the model id plus an input object whose fields are listed on each model's page. Credits are held when you submit and charged only if the task succeeds.
curl https://api.tapmodels.com/v1/tasks \
-H "Authorization: Bearer $TAPMODELS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2-1",
"input": {
"prompt": "A ceramic coffee cup on a linen tablecloth, morning light",
"aspect_ratio": "1:1",
"resolution": "1K"
},
"callback_url": "https://example.com/hooks/tapmodels"
}'
# 202 {"id": "task_8k2m4q1z", "status": "queued", "estimated_credits": 2}Then poll the task until status is succeeded or failed, or skip polling and wait for the webhook.
curl https://api.tapmodels.com/v1/tasks/task_8k2m4q1z \
-H "Authorization: Bearer $TAPMODELS_API_KEY"{
"id": "task_8k2m4q1z",
"model": "nano-banana-2-1",
"status": "succeeded",
"input": { "prompt": "A ceramic coffee cup on a linen tablecloth, morning light", "aspect_ratio": "1:1", "resolution": "1K" },
"output": { "urls": ["https://..."], "text": null },
"error": null,
"credits_charged": 2,
"created_at": "2026-11-25T09:14:02Z",
"finished_at": "2026-11-25T09:14:09Z"
}Output URLs stay available for 14 days. Download anything you want to keep.
Webhooks
Pass callback_url when you create a task. When the task finishes, successfully or not, we POST the task object to that URL. Any response other than 2xx is retried with backoff for up to 24 hours. Every attempt shows up on the webhooks page.
Each delivery carries an X-Signature header: t is the Unix time it was signed and v1 is the hex HMAC-SHA256 of <t>.<raw body>, keyed with your account's webhook secret.
X-Signature: t=1764062049,v1=5d41402abc4b2a76b9719d911017c592...import crypto from "node:crypto";
// rawBody: the request body exactly as received (a string or Buffer, before JSON.parse).
export function verifySignature(rawBody, header, secret, toleranceSec = 300) {
const parts = Object.fromEntries(header.split(",").map((p) => p.trim().split("=")));
const t = Number(parts.t);
if (!t || !parts.v1) return false;
if (Math.abs(Date.now() / 1000 - t) > toleranceSec) return false; // stale or replayed
const expected = crypto
.createHmac("sha256", secret)
.update(`${t}.${rawBody}`)
.digest("hex");
const a = Buffer.from(expected, "hex");
const b = Buffer.from(parts.v1, "hex");
return a.length === b.length && crypto.timingSafeEqual(a, b);
}Verify against the raw body, before parsing it. Re-serialising the JSON changes the bytes and the signature will not match.
Chat models
Chat models answer synchronously. POST /chat/completions accepts the OpenAI request format, including stream: true for server-sent events, so the official OpenAI SDKs work once you change the base URL. Billing is per token at the model's listed price.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.TAPMODELS_API_KEY,
baseURL: "https://api.tapmodels.com/v1",
});
const res = await client.chat.completions.create({
model: "claude-sonnet-5-5",
messages: [{ role: "user", content: "Write a haiku about rail yards." }],
});
console.log(res.choices[0].message.content);If your code already speaks the Anthropic format, use POST /messages instead.
curl https://api.tapmodels.com/v1/messages \
-H "Authorization: Bearer $TAPMODELS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Summarise this changelog in three bullets." }]
}'Files
To pass a local image or video as input, upload it first with POST /files (multipart, up to 30 MB) and put the returned URL in the task's input, for example image_input or image_url.
curl https://api.tapmodels.com/v1/files \
-H "Authorization: Bearer $TAPMODELS_API_KEY" \
-F "file=@product.jpg"
# {"url": "https://...", "expires_at": "2026-12-09T09:14:02Z"}Errors
Errors use the HTTP status plus a JSON body with a stable code you can branch on, and a message written for people.
{ "error": { "code": "insufficient_credits", "message": "This task needs 32.5 credits. Top up to continue." } }| Status | Code | What to do |
|---|---|---|
| 401 | unauthorized | The key is missing, mistyped or revoked. Check the Authorization header. |
| 402 | insufficient_credits | Your balance is lower than the task's estimated cost. Top up, then retry. |
| 402 | key_limit_reached | This key hit its spend limit. Raise the limit on the keys page or use another key. |
| 404 | model_not_found | No model with that id. Ids are listed in the model reference below. |
| 422 | invalid_input | A field in input is missing or out of range. Check the field list on the model's page. |
| 429 | rate_limited | More than 20 new tasks in 10 seconds. Wait for the Retry-After header, then retry. |
| 5xx | upstream_error | The provider or our API failed. Nothing is charged. Retry with exponential backoff, starting at a few seconds. |
Model reference
Every model page lists its input fields and prices. Use the id in the model field.
- GPT Image 2gpt-image-2
- Nano Banana 2.1nano-banana-2-1
- Seedream 5.5seedream-5-5
- FLUX.2 Proflux-2-pro
- Veo 3.1veo-3-1
- Kling 4.0kling-4-0
- Seedance 2.5seedance-2-5
- Wan 3.0wan-3-0
- Grok Imagine Video 1.5grok-imagine-1-5
- Sunosuno
- ElevenLabselevenlabs
- Gemini 3.8 Flash TTSgemini-tts
- Claude Opus 5.5claude-opus-5-5
- Claude Sonnet 5.5claude-sonnet-5-5
- GPT-6.2 Solgpt-6-2-sol
- Gemini 4 Hydrogengemini-4-hydrogen
- Claude Fable 5claude-fable-5
- Claude Haiku 5.5claude-haiku-5-5
- GPT-6.2 Astragpt-6-2-astra
- Gemini 4 Neongemini-4-neon
- Grok 4.7grok-4-7