apiai.me Docs

API Documentation

Everything you need to integrate apiai.me into your application.

Overview

apiai.me gives you a library of pre-built Tools — ready-to-use API endpoints for image generation, editing, background removal, video creation, and more. Each tool is a single REST call with its own parameters, defaults, and pricing.

You can also create Pipelines that chain multiple tools into one API call, passing data from step to step automatically.

All API responses are JSON unless the endpoint returns binary data (images, video). Errors follow a consistent format:

Error Response
{ "error": "description of what went wrong" }

How It Works

1. Browse the Toolbox

Log in to the Dashboard and open the API Toolbox. You'll see every tool available to your account — each with its parameters, defaults, options, and a ready-made curl command.

API Toolbox dashboard showing available tools with parameters and curl commands

2. Test in the playground

Expand any tool to see its full parameter form. Adjust values, upload an image, and hit Run to test it live — right in the browser. The result appears instantly so you can iterate before writing any code.

Tool playground with parameter form, Run button, and live result

3. Call the API

Copy the generated curl command (or use any HTTP client) and call the endpoint from your app. Every tool follows the same pattern:

Basic pattern
curl -X POST https://apiai.me/api/process/{tool-slug} \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@photo.png" \
  -F "prompt=your prompt here" \
  --output result.png

4. Build pipelines (optional)

Need multiple steps? Create a Pipeline that chains tools together — e.g. generate an image, then remove its background, then convert to greyscale — all in a single API call.

Pipeline builder showing chained tools in a multi-step pipeline

Authentication

Sign up at apiai.me to create your account. Authentication is passwordless — you receive a one-time code by email, verify it, and receive a session token for the dashboard. Your api_key is shown once at registration; use it for all programmatic API calls.

Step 1 — Request a login code

POST /api/login

Request Body

FieldTypeDescription
email requiredstringThe email associated with your account
Example
curl -X POST https://apiai.me/api/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@company.com"}'
Response 200
{ "requires_verification": true, "email": "you@company.com" }

A 6-digit one-time code is emailed to you. Codes expire after 24 hours.

Step 2 — Verify the code and get your session

POST /api/verify

Request Body

FieldTypeDescription
email requiredstringSame email used in the login request
code requiredstringThe 6-digit code from the email
Example
curl -X POST https://apiai.me/api/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "you@company.com", "code": "482916"}'
Response 200
{ "session_token": "sess_...", "username": "you", "email": "you@company.com" }

Your API key (ak_...) is provided once at registration. Store it securely — it cannot be retrieved later. You can regenerate a new key from the Dashboard at any time.

Step 3 — Use your API key

Pass your API key in the X-API-Key header on every protected request.

Header
X-API-Key: ak_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

If your key is compromised, you can regenerate it from the Dashboard — the old key is immediately invalidated.

Rate Limits

To protect service stability, the API enforces the following limits:

LimitScopeValue
Concurrent requestsPer user2 in-flight
Server-wide concurrencyGlobal5 in-flight
Request body sizePer request20 MB

When you exceed the per-user concurrency limit, the API returns 429 Too Many Requests:

Response 429
{ "error": "Too many concurrent requests. Maximum 2 in-flight requests per user." }

When the server is at full capacity, the API returns 503 Service Unavailable:

Response 503
{ "error": "Server at capacity. Maximum 5 concurrent requests. Please retry shortly." }

Wait for an in-flight request to complete before sending the next one, or use the Batch API for high-volume workloads — batched items are queued server-side and don't count against the concurrency limit.

Base URL

https://apiai.me/api

All endpoint paths below are relative to this base URL.

List Tools

GET /workflows

List all tools available to your account. Each tool has a slug used in the process endpoint.

Example
curl https://apiai.me/api/workflows \
  -H "X-API-Key: ak_xxxx"
Response 200
[
  {
    "id": 7,
    "slug": "greyscale",
    "name": "Greyscale",
    "description": "Convert image to greyscale",
    "endpoint": "/api/process/greyscale",
    "method": "POST",
    "type": "workflow",
    "accepted_inputs": ["image"],
    "required_inputs": ["image"],
    "response_type": "image",
    "output_types": ["image"],
    "params": [ ... ]
  },
  {
    "id": 3,
    "slug": "logo-digitalize",
    "name": "Logo Digitalize",
    "description": "Multi-step logo pipeline",
    "endpoint": "/api/pipeline/logo-digitalize",
    "method": "POST",
    "type": "pipeline",
    "params": []
  }
]

The list includes both individual tools (type: "workflow") and admin-configured pipelines (type: "pipeline"). Use the endpoint field to determine the correct URL to call.

accepted_inputs lists which input types the tool understands (e.g. image, text, video, audio). required_inputs is the subset of those that are mandatory — anything in accepted_inputs but not in required_inputs is optional.

Run a Tool

POST /process/{slug}

Run a tool. Accepts multipart/form-data. The response type depends on the tool — image, video, or JSON text (check output_types in the tool list).

Parameters

FieldTypeDescription
image optionalfile / file[]Input image (PNG, JPG, WebP). Required for image-editing tools; optional or unused for generation tools. Some tools accept multiple images — check max_images in the tool list.
prompt optionalstringText prompt — required for generation tools, optional for editing tools.
{param} optionalstringAny tool-specific parameter. Use GET /api/workflows to list available params per tool.

Response types

response_typeContent-TypeSave with
image (default)image/png, image/jpeg, etc.--output result.png
videovideo/mp4--output result.mp4
audioaudio/mpeg, audio/wav, etc.--output result.mp3
textapplication/json--output result.json
Image editing
curl -X POST https://apiai.me/api/process/greyscale \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@photo.png" \
  --output result.png
Text-to-image (prompt only)
curl -X POST https://apiai.me/api/process/create-image \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=a minimalist tech logo" \
  --output result.png
Text-to-video (prompt + params)
curl -X POST https://apiai.me/api/process/generate-video \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=aerial view of a coral reef" \
  -F "ASPECT_RATIO=16:9" \
  -F "DURATION=4" \
  --output result.mp4
Multi-image input (tools with max_images > 1)
curl -X POST https://apiai.me/api/process/nano-banana-2 \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@photo1.png" \
  -F "image=@photo2.png" \
  -F "prompt=combine these images" \
  --output result.png

Streaming progress (long-running tools)

For Replicate-backed tools that can take minutes (video generation, complex image models), append /stream to get real-time progress updates as a Server-Sent Events (SSE) stream. When the job finishes, pick up the result from GET /api/result/:id using the result_id in the final event.

SSE event typeMeaning
createdPrediction submitted to Replicate
startingReplicate is booting the model
processingModel is actively generating (sent on each poll)
doneJob complete — contains result_id and content_type
errorJob failed — contains message
Stream a video generation job
# Step 1 – submit and stream progress (-N disables curl buffering)
curl -N -X POST https://apiai.me/api/process/generate-video/stream \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=aerial view of a coral reef" \
  -F "ASPECT_RATIO=16:9"

# Each SSE line looks like:
# data: {"type":"starting","elapsed_ms":0}
# data: {"type":"processing","elapsed_ms":4200}
# data: {"type":"done","elapsed_ms":47300,"result_id":"a3f9...","content_type":"video/mp4"}

# Step 2 – download the result using the result_id from the done event
curl https://apiai.me/api/result/a3f9... \
  -H "X-API-Key: ak_xxxx" \
  --output result.mp4

Results are stored for 10 minutes and can only be retrieved once. Streaming requires the tool to be a Replicate workflow; other server types should use the synchronous endpoint.

Check supports_prompt and output_types in the tool list to know what each tool expects and returns.

Response headers:

HeaderDescription
X-Request-IDUnique request identifier (UUID)
X-Processing-TimeServer-side processing time in ms
X-CostCost charged for this request in USD
X-Balance-RemainingYour account balance after this request
X-WorkflowThe workflow or pipeline slug that was executed
X-Pipeline-StepsNumber of steps (only for multi-step pipelines)

Pipelines

POST /pipeline/{slug}

Execute a multi-step pipeline. Pipelines chain multiple tools together — the output of each step feeds into the next.

Parameters

FieldTypeDescription
image requiredfileThe input image
Example
curl -X POST https://apiai.me/api/pipeline/logo-digitalize \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@logo.png" \
  --output result.png

Batch Processing

Process multiple images through a single workflow in one request. The server queues all items, processes them in parallel, and provides real-time progress via SSE. Results are available as a ZIP download for 24 hours.

POST /batch

Create a new batch job. Upload multiple images and specify a workflow slug (or flow:slug for a user pipeline). All images will be processed with the same workflow/pipeline and parameters.

Parameters

FieldTypeDescription
workflow requiredstringWorkflow slug (e.g. remove-bg) or flow slug prefixed with flow: (e.g. flow:my-pipeline)
images requiredfile[]Multiple image files (max limit set by server, default 50)
any paramstringAdditional workflow/pipeline-specific parameters (applied to all images)
Example — workflow
curl -X POST https://apiai.me/api/batch \
  -H "X-API-Key: ak_xxxx" \
  -F "workflow=remove-bg" \
  -F "images=@photo1.png" \
  -F "images=@photo2.png" \
  -F "images=@photo3.png"
Example — user pipeline
curl -X POST https://apiai.me/api/batch \
  -H "X-API-Key: ak_xxxx" \
  -F "workflow=flow:my-pipeline" \
  -F "images=@photo1.png" \
  -F "images=@photo2.png"

Response: 201 Created with job ID, status, total items, and estimated cost.

GET /batch

List your batch jobs (most recent first, max 50).

Example
curl https://apiai.me/api/batch \
  -H "X-API-Key: ak_xxxx"
GET /batch/{id}

Get batch job status and all item details.

Example
curl https://apiai.me/api/batch/42 \
  -H "X-API-Key: ak_xxxx"
POST /batch/{id}/cancel

Cancel a running batch job. Items already completed are kept; remaining items are skipped.

Example
curl -X POST https://apiai.me/api/batch/42/cancel \
  -H "X-API-Key: ak_xxxx"
GET /batch/{id}/download

Download all completed results as a ZIP archive. Available for 24 hours after job completion.

Example
curl https://apiai.me/api/batch/42/download \
  -H "X-API-Key: ak_xxxx" \
  --output results.zip

Batch progress is also streamed via SSE Events with event types batch_created and batch_progress.

Usage

GET /usage

Get aggregated usage statistics for your account.

Example
curl https://apiai.me/api/usage \
  -H "X-API-Key: ak_xxxx"

Logs

GET /logs

Retrieve recent request logs for your account.

Query Parameters

ParamTypeDescription
limit optionalintNumber of logs to return (default 50, max 200)
Example
curl https://apiai.me/api/logs?limit=20 \
  -H "X-API-Key: ak_xxxx"

SSE Events

GET /events

Server-Sent Events stream. Pushes real-time updates (new logs, usage changes) to connected clients. Authentication is via the X-API-Key header.

Note: the browser EventSource API does not support custom headers. Use fetch() with a readable stream, or pass the key via a proxy.

Example (fetch)
const resp = await fetch('/api/events', {
  headers: { 'X-API-Key': 'ak_xxxx' }
});
const reader = resp.body.getReader();
const decoder = new TextDecoder();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  console.log(decoder.decode(value));
}

Billing

Payments are processed securely via Stripe. Each API call deducts from your account balance. When your balance is insufficient you'll receive a 402 Payment Required response.

GET /account/balance

Returns your current account balance.

Example
curl https://apiai.me/api/account/balance \
  -H "X-API-Key: ak_xxxx"
Response
{ "balance": 47.50 }
POST /account/create-checkout

Create a Stripe Checkout session to top up your balance ($10, $50, or $100). Returns a URL to redirect to for payment. Your card is saved for future auto-refill charges.

Body Parameters (JSON)

ParamTypeDescription
amount requirednumberTop-up amount: 10, 50, or 100
Example
curl -X POST https://apiai.me/api/account/create-checkout \
  -H "X-API-Key: ak_xxxx" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50}'
Response
{ "url": "https://checkout.stripe.com/c/pay/..." }
GET /account/auto-refill

Get your auto-refill settings. When enabled, your saved card is charged automatically when your balance drops below $5.

Response
{ "enabled": true, "amount": 50 }
PUT /account/auto-refill

Enable or disable auto-refill. Requires a saved payment method (make at least one Stripe checkout payment first).

Body Parameters (JSON)

ParamTypeDescription
enabled requiredboolTurn auto-refill on or off
amount requirednumberAmount to charge: 10, 50, or 100
Example
curl -X PUT https://apiai.me/api/account/auto-refill \
  -H "X-API-Key: ak_xxxx" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "amount": 50}'

List Pipelines

GET /flows

List your custom pipelines (user-created tool chains).

Example
curl https://apiai.me/api/flows \
  -H "X-API-Key: ak_xxxx"

Create Pipeline

POST /flows

Create a custom pipeline by chaining existing tools. You must have access to all referenced tools. Optionally provide a flow_config for node-based pipelines with clean parameter names.

Request Body

FieldTypeDescription
name requiredstringDisplay name for the pipeline
slug requiredstringURL-safe slug (e.g. my-pipeline)
workflow_ids requiredint[]Ordered list of tool IDs (from /workflows)
flow_config optionalobjectNode-based pipeline config. Contains nodes (array of node objects with tool slug and per-param config) and output_node (ID of final node). Each param can be expose (user API param), fixed (baked-in), or from_node (wired from previous node).
Legacy pipeline (step-based)
curl -X POST https://apiai.me/api/flows \
  -H "X-API-Key: ak_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Pipeline",
    "slug": "my-pipeline",
    "workflow_ids": [3, 5]
  }'
Node-based pipeline (clean params)
curl -X POST https://apiai.me/api/flows \
  -H "X-API-Key: ak_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Generate & Remove BG",
    "slug": "gen-remove-bg",
    "workflow_ids": [3, 5],
    "flow_config": {
      "nodes": [
        {
          "id": "node_1",
          "workflow": "seedream-4",
          "params": {
            "prompt": {"source": "expose", "expose": "prompt", "required": true},
            "style": {"source": "fixed", "fixed": "photorealistic"}
          }
        },
        {
          "id": "node_2",
          "workflow": "remove-background",
          "params": {
            "image": {"source": "from_node", "from_node": "node_1", "is_image": true}
          }
        }
      ],
      "output_node": "node_2"
    }
  }'

Execute Pipeline

POST /flow/{slug}

Run a custom pipeline. Data passes through each step sequentially. For node-based pipelines, use the clean parameter names shown in /flows. For legacy pipelines, parameters are step-suffixed (e.g. prompt_1).

Pipelines may include gate nodes that validate content before proceeding. If a gate rejects the input, the pipeline stops early and returns 422 Unprocessable Entity with an error message explaining why. Gates can expose a named input parameter (e.g. check_image) so the API caller can provide content specifically for the gate to evaluate.

If an exposed image input supports multiple uploads (for example a first step backed by a workflow with max_images > 1), repeat that same multipart field name multiple times in one request.

FieldTypeDescription
imagefileInput image. Optional if the pipeline supports prompts. For node-based pipelines, use the exposed param name (e.g. image). Repeat the field to send multiple images when the pipeline supports it.
prompt optionalstringText prompt (for pipelines whose first step supports generation)
{param} optionalstringAny pipeline parameter. Node-based pipelines use clean names (e.g. style, aspect_ratio); legacy pipelines use step-suffixed names (e.g. style_1).
Node-based pipeline (clean params)
curl -X POST https://apiai.me/api/flow/gen-remove-bg \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=a cute dog on white background" \
  --output result.png
Image through pipeline
curl -X POST https://apiai.me/api/flow/my-pipeline \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@input.png" \
  --output result.png
Multi-image pipeline input
curl -X POST https://apiai.me/api/flow/my-pipeline \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@input-1.png" \
  -F "image=@input-2.png" \
  --output result.png
Prompt-only (generate + process)
curl -X POST https://apiai.me/api/flow/create-and-remove-bg \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=a cute dog on a white background" \
  --output result.png

Quality Gates

Quality gates are special pipeline nodes that evaluate content (image, text, or both) against a custom prompt and return a YES or NO decision. They are powered by a fast AI model (~$0.001 per evaluation) and enable automated content moderation, quality control, and conditional routing inside pipelines.

How it works

A gate node receives the output from the previous step (image and/or text) and evaluates it against the gate prompt — a plain-language question like "Is this image safe for all audiences?" or "Does the product appear clearly?". The AI responds YES or NO.

Branching

Each branch (YES / NO) can be configured to:

ActionBehaviour
nextContinue to the next node in the pipeline (default for YES)
stopStop the pipeline and return a message (default for NO)
{node_id}Jump to a specific node — enables conditional routing

Response behaviour

When a gate stops the pipeline:

BranchHTTP StatusResponse body
NO → stop422{"error": "...", "gate_node": "...", "gate_response": "...", "cost": ...}
YES → stop200{"message": "...", "gate_node": "...", "gate_response": "...", "cost": ...}

When a gate continues (next or branch), the previous image and text are forwarded to the target node automatically.

Custom messages

Each branch can define a custom message returned when the pipeline stops at that branch. If no message is set, defaults are used ("Content did not pass quality gate" for NO, "Pipeline completed" for YES).

Use cases

  • Content moderation — block unsafe, off-brand, or policy-violating outputs before delivery
  • Quality control — reject blurry, cropped, or low-quality generated images
  • Conditional routing — send YES results to one processing path and NO results to another
  • Approval workflows — gate on subjective criteria like brand consistency or style match

Quality Gate

POST /v1/quality-gate

Ask any YES/NO question about an image and/or text. A general-purpose evaluation endpoint powered by fast AI (~$0.001 per call). Use for content moderation, quality checks, object detection, classification, and more. This is the standalone version of the Quality Gate node used inside pipelines.

Request

Send as multipart/form-data:

ParameterTypeRequiredDescription
promptstringYesA YES/NO question to evaluate (e.g. "Does this image contain a person?")
imagefileNo*Image file to evaluate (JPEG, PNG, WebP, GIF)
image_base64stringNo*Alternative: base64-encoded image data
textstringNo*Text content to evaluate

* At least one of image, image_base64, or text is required alongside the prompt.

Response (200 OK)

Success response
{
  "version": "1.0",
  "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "answer": true,
  "response": "YES",
  "prompt": "Does this image contain a person?",
  "latency_ms": 312
}

Response fields

FieldTypeDescription
answerbooleantrue = YES, false = NO
responsestringRaw model response text
promptstringThe prompt that was evaluated
latency_msintegerEvaluation time in milliseconds

Example prompts

Use casePrompt
Person detectionDoes this image contain a person?
Quality checkIs this a high-quality, well-lit photograph?
TransparencyDoes this image have a transparent background?
NSFW filterDoes this image contain NSFW or inappropriate content?
Text detectionDoes this image contain readable text?
Brand checkDoes this image contain a company logo?
Text moderationIs this text toxic or offensive? (with text field)

curl examples

Check an image
curl -X POST https://apiai.me/api/v1/quality-gate \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=Does this image contain a person?" \
  -F "image=@photo.jpg"
Check text content
curl -X POST https://apiai.me/api/v1/quality-gate \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=Is this text toxic or offensive?" \
  -F "text=Hello, this is a friendly message"
Check both image and text
curl -X POST https://apiai.me/api/v1/quality-gate \
  -H "X-API-Key: ak_xxxx" \
  -F "prompt=Does this product image match the description?" \
  -F "image=@product.jpg" \
  -F "text=Red leather handbag with gold clasp"

Moderation: Check Image

POST /v1/moderation/check-image

Evaluate an image against a configurable policy and receive a structured JSON decision. Always returns 200 for successful checks — the decision (allow, reject, or review) is in the response body, not the HTTP status code. Powered by a fast AI model (~$0.001 per check).

Request

Send as multipart/form-data:

ParameterTypeRequiredDescription
imagefileYes*Image file to check (JPEG, PNG, WebP, GIF)
image_base64stringYes*Alternative: base64-encoded image data
policystringNoBuilt-in policy slug (see table below) or any custom label. Default: general
policy_promptstringNoCustom moderation instructions. When supplied, overrides the built-in policy prompt.
metadataJSON stringNoCaller metadata (passed through for your reference)

* Provide either image or image_base64, not both.

Built-in policies

Pass one of these slugs as policy and omit policy_prompt to use the pre-built moderation instructions. You can override any preset by supplying your own policy_prompt.

Policy slugWhat it checks
generalGeneral appropriateness — offensive, violent, or explicit content (default)
nsfwSexually explicit or adult content, nudity
adultAlias for nsfw
violenceGraphic violence, gore, weapons used against people
brand-safetySafe for mainstream brand advertising (combines NSFW + violence + hate)
product-photoE-commerce quality — clear, well-lit product on clean background
hate-speechHate symbols, extremist imagery, dehumanising content
spamJunk, watermarked stock photos, auto-generated filler, test patterns

For domain-specific checks (e.g. "does this image contain our product logo?") use a custom policy label and supply policy_prompt with your own instructions.

Response (200 OK)

Success response
{
  "version": "1.0",
  "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "decision": "reject",
  "confidence": 0.97,
  "policy": "dog-only-v1",
  "reasons": [
    {
      "code": "NO_DOG_DETECTED",
      "message": "No dog detected in image"
    }
  ],
  "signals": {
    "dog_detected": false,
    "nsfw": false
  },
  "latency_ms": 412
}

Decision values

DecisionMeaningWhen to use
allowImage passes the policyProceed with processing
rejectImage fails the policyBlock or discard
reviewAmbiguous / low confidenceQueue for human review

HTTP status codes

StatusMeaning
200Check completed — decision is in the body
400Invalid request (missing image, bad mime type, too large)
401/403Authentication error
402Insufficient balance
429Rate limit exceeded
500Internal moderation failure

Error responses (non-200)

Error shape
{"error": {"code": "INVALID_IMAGE", "message": "Unsupported image type"}}

Response headers

HeaderDescription
X-Request-IDUnique request ID (send your own via header to correlate)
X-Processing-TimeServer-side latency in ms
X-CostCost charged for this check
X-Balance-RemainingYour remaining balance

curl examples

NSFW check (built-in policy)
curl -X POST https://apiai.me/api/v1/moderation/check-image \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@photo.jpg" \
  -F "policy=nsfw"
Brand-safety check (built-in policy)
curl -X POST https://apiai.me/api/v1/moderation/check-image \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@photo.jpg" \
  -F "policy=brand-safety"
Custom policy with your own instructions
curl -X POST https://apiai.me/api/v1/moderation/check-image \
  -H "X-API-Key: ak_xxxx" \
  -F "image=@photo.jpg" \
  -F "policy=dog-only-v1" \
  -F 'policy_prompt=Check whether the image contains a dog as the main subject'
Check with base64
curl -X POST https://apiai.me/api/v1/moderation/check-image \
  -H "X-API-Key: ak_xxxx" \
  -F "image_base64=$(base64 -i photo.jpg)" \
  -F "policy=nsfw"
Custom request ID for correlation
curl -X POST https://apiai.me/api/v1/moderation/check-image \
  -H "X-API-Key: ak_xxxx" \
  -H "X-Request-ID: my-correlation-id-123" \
  -F "image=@photo.jpg"

Pipeline integration

This endpoint uses the same evaluation engine as Quality Gates in pipelines. When a gate node is used inside a pipeline, downstream condition nodes can branch on decision, confidence, and reasons[].code from the structured moderation result.

Delete Pipeline

DELETE /flows/{id}

Delete a custom pipeline by its ID.

Example
curl -X DELETE https://apiai.me/api/flows/42 \
  -H "X-API-Key: ak_xxxx"

MCP Server

Use apiai.me directly from AI-enabled editors and local AI tools like VS Code (Copilot), Cursor, Windsurf, Ollama, and others that support the Model Context Protocol. No binary to install — just point your client at our hosted MCP endpoint.

MCP https://apiai.me/api/mcp

The server uses the Streamable HTTP transport. Authenticate with your API key via the X-API-Key header.

VS Code — .vscode/mcp.json

VS Code
{
  "servers": {
    "apiai": {
      "type": "http",
      "url": "https://apiai.me/api/mcp",
      "headers": {
        "X-API-Key": "ak_xxxx"
      }
    }
  }
}

Cursor — .cursor/mcp.json

Cursor
{
  "mcpServers": {
    "apiai": {
      "url": "https://apiai.me/api/mcp",
      "headers": {
        "X-API-Key": "ak_xxxx"
      }
    }
  }
}

Ollama — ~/.ollama/mcp.json

Ollama
{
  "mcpServers": {
    "apiai": {
      "url": "https://apiai.me/api/mcp",
      "headers": {
        "X-API-Key": "ak_xxxx"
      }
    }
  }
}

Available tools

Once connected, your AI assistant has access to these tools:

ToolDescription
list_workflowsDiscover available tools, parameters, and pricing
list_flowsList your custom pipelines
generate_imageGenerate an image from a text prompt
edit_imageProcess an image through a tool (base64 input/output)
run_flowExecute a pipeline
check_balanceCheck your account balance
get_accountGet account details

Example prompts

Things you can ask your AI assistant
"Generate a minimalist tech logo using apiai"
"Remove the background from this image (pass base64)"
"Run my create-and-remove-bg pipeline with prompt 'a cute dog'"
"What tools do I have access to?"
"Check my apiai balance"