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.

shell
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.

shell
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.

shell
curl https://api.tapmodels.com/v1/tasks/task_8k2m4q1z \
  -H "Authorization: Bearer $TAPMODELS_API_KEY"
json
{
  "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.

http
X-Signature: t=1764062049,v1=5d41402abc4b2a76b9719d911017c592...
node
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.

node
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.

shell
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.

shell
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.

json
{ "error": { "code": "insufficient_credits", "message": "This task needs 32.5 credits. Top up to continue." } }
StatusCodeWhat to do
401unauthorizedThe key is missing, mistyped or revoked. Check the Authorization header.
402insufficient_creditsYour balance is lower than the task's estimated cost. Top up, then retry.
402key_limit_reachedThis key hit its spend limit. Raise the limit on the keys page or use another key.
404model_not_foundNo model with that id. Ids are listed in the model reference below.
422invalid_inputA field in input is missing or out of range. Check the field list on the model's page.
429rate_limitedMore than 20 new tasks in 10 seconds. Wait for the Retry-After header, then retry.
5xxupstream_errorThe 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.

Image
Video
Audio
Chat