spicyapiDocs
Main content

Developer API FAQ

Quick developer answers on SpicyAPI USD billing, failed-task holds, upload formats, output rights, retention clocks, SDKs, and error codes.

Short answers, each with a link to the page that has the full rules. If a word is unfamiliar, the glossary explains it. For a guided introduction, read How SpicyAPI works first.

Getting started

Do I need to know how to code?

No. You can try any model in your browser with the Playground tab on its page at spicyapi.ai/explore, generate images and videos by chatting with an AI assistant through the MCP server, or type ready-made commands with the CLI. Code is only needed to build SpicyAPI into your own product. Choose your path compares the options.

Is there a free tier or a free trial?

No. New accounts start with a balance of $0, so you add funds before your first generation. Plenty is free, though: browsing models and prices, filling in the Playground form, getting quotes, checking your balance and looking up tasks. Failed or expired tasks normally release the full hold. Some content refusals are charged at the accepted quote only when the model page explicitly discloses this exception. Check settled and cost for the final charge.

How do I get an API key?

Create an account at spicyapi.ai/register and verify your email address, then open API keys in the console and choose Create key. Copy the key straight away: it starts with sk-spicy- and is shown only once. You can give the key a daily spend cap on the same page; new keys have none unless you set one. Set up your account shows every screen.

I lost my API key, or it may have leaked. What now?

A lost key cannot be shown again, because we only store a scrambled version of it. Create a new one. If it may have leaked, disable it in the console first, which takes effect immediately, then create a replacement, check Logs for spending you do not recognise, and give the new key an appropriate spend cap. Disabling a key does not stop tasks that were already accepted. Tasks created with the old key can no longer be read through the API with a different key, but they stay visible in the console's Logs. See Authentication.

Which model ID should I use?

Take it from the live catalog with your API key: spicyapi models list, listModels() in the SDK, or GET /api/v1/models. IDs look like publisher/model/task. Pick one whose enabled and available are both true, and do not reuse an ID from memory or an old web page, because models are added, paused and retired. Code examples in these docs write MODEL_ID_FROM_CATALOG where a real ID goes. See Model catalog and schemas.

Can I call SpicyAPI directly from my website or mobile app?

No. Anything shipped to a browser or a phone can be read by its users, including your API key, and a leaked key can spend your balance. Have your website or app call your own server, and let the server call SpicyAPI. The official SDK only runs on servers for the same reason. See Authentication.

Can I get error messages in my own language?

Yes. Error messages can come back in English, Japanese, Korean, German, French, Spanish, Brazilian Portuguese, Russian, Italian or Polish. Choose one for your whole account under Settings → API error language in the console, or per request with an Accept-Language header. Chinese is not offered. Only the wording changes: code and errorCode stay the same, and a failed task may still carry the model's own explanation in English. See Errors.

Is SpicyAPI available where I am?

SpicyAPI does not serve mainland China. A small number of other regions are restricted as well. Sign-up, payments and API requests from restricted regions are refused, usually with business code 40303, and a VPN does not change what the terms allow. The terms of service also exclude Hong Kong, Macau and several other countries, where the service is not offered. See Content and usage responsibility.

Pricing and payments

How is pricing calculated?

Each model has a price in US dollars per unit: per image, per second of finished video, per request, or per token for text models (input and output are counted separately). Settings such as resolution, duration, or generate_audio can move a model into a different price tier, so a price marked "from" is the cheapest tier. Call POST /api/v1/jobs/quote (or check the Playground estimate) before submitting: the accepted hold becomes your hard charge ceiling, protecting your effective budget per usable output. Discounts you qualify for are applied automatically, and offers do not stack: you get the lowest price. See Billing and the pricing page.

How do I add funds?

Open Billing in the console and choose Add funds. You can pay by card (Visa or Mastercard, plus Apple Pay and Google Pay where your device supports them), which is credited within seconds, or with crypto such as Bitcoin, Ethereum or USDT, credited once the network confirms. Some accounts also see a manual transfer option. Your balance does not expire. Add funds walks through each option.

Am I charged if a task fails?

Failed or expired tasks normally release the full hold. Some content refusals are charged at the accepted quote only when the model page explicitly discloses this exception. Check settled and cost for the final charge. A request that is refused outright, for example with 400, 402 or 429, creates no task and costs nothing. A timeout on your side is different: the task may still be running, so check it before sending anything new. See Billing.

Can the final charge be higher than the estimate?

Not for image and video tasks. The amount set aside when a task is accepted is also its ceiling: you pay for actual usage up to that amount, and anything unused is returned. The text endpoints that follow the OpenAI, Anthropic and Gemini formats charge the price in force when a request is accepted and take no quote, so protect those with spend caps. See Billing.

The result is not what I wanted. Can I get a refund?

A task that succeeded is charged, even if the output disappointed you or the model toned the content down. Review a model's page and try it on a small request before running many. We do investigate billing errors on our side: the same task charged twice, a charge above the estimate you confirmed, or a success recorded without a result being delivered. Open a conversation on the console's Support page with the task ID. See the refund policy.

Can I get my unused balance back?

No. Top-ups are non-refundable, and a balance cannot be paid out as cash. Your paid balance never expires, so it stays available for as long as your account is open. If a charge looks wrong — for example, a charge that contradicts the model page’s billing terms, or a payment that never reached your balance — open a conversation on the console's Support page or email support@spicyapi.ai with the task or order ID. We investigate and correct confirmed errors on your balance. Promotional bonuses have no cash value. See the refund policy.

How do I stop a bug from spending my whole balance?

Set spend caps on each API key under API keys: a daily, a monthly and a lifetime limit in dollars. New keys have no cap until you set one. When a cap is reached, new tasks are refused with 40202 before anything is charged. Use one key per app or environment, so you can cap or disable each one separately, and teams can add their own daily and monthly budgets. See Billing.

Can I get an invoice?

Yes. Under Billing → Invoices in the console you can issue a payment invoice for a top-up you have paid, or a usage statement for a closed month, and download either as a PDF. Enter your invoice details once first: a name, address and country are required, and a tax ID is optional. No VAT or GST is added, and every invoice carries a reverse-charge notice. See Invoices and receipts.

Generating images and videos

How long does a generation take?

Images usually take seconds; videos often take a few minutes, and longer clips or higher resolutions take longer. The creation response includes deadlineAt, the latest time the task can still finish, which for some video models is up to an hour after you submit. A task that runs past its deadline ends as expired and is not charged. If you stop waiting, the task carries on; look it up again with its task ID. See Asynchronous tasks.

Can I cancel a task?

No. Once a task is accepted it runs to the end, whether it is still queued or already running. Closing the page, stopping your program or disabling the key only stops your waiting. Check the price before you submit. If you no longer want a finished result kept, you can destroy its content, but that does not refund the charge. See Task commitment and retry.

How do I use my own image as input?

Check the model's input schema for the field that takes it, such as image_url. You can then pass a public HTTPS link to the image, a small image embedded as a data URI (up to 1 MiB), or a file you upload. Uploading gives you a spicy:// address that can be used for one day; images can be up to 10 MiB, and videos or audio up to 90 MiB. The Playground, spicyapi files upload, uploadFile() in the SDK and the MCP server all handle the upload for you. The image-to-video tutorial shows the whole job, and Media has the limits.

How do I get the finished file?

When a task succeeds, its result lists each file under output.assets[] with a url. Download that link directly; it needs no API key. The link lasts about 20 minutes, and asking for the task again gives you a fresh one. Generated files are kept for about 14 days at most, so save your own copy. You find out a task has finished either with a webhook or by asking again. In the Playground, use the Download button; with the CLI, spicyapi tasks get. See Asynchronous tasks.

How do I find a task I created earlier?

The console's Logs page lists every task on your account, failures included, and you can search by task ID or request ID. Through the API, GET /api/v1/jobs lists the tasks created by the same API key you call it with, as do spicyapi tasks list, listTasks() in the SDK and the MCP tool spicyapi_tasks_list. A task created with another key returns 404 through the API, so use Logs for those. The list does not include prompts or files; open a single task to get its result. See Logs and Asynchronous tasks.

Can I retry a failed task?

Yes, if it ended as failed or expired: choose Retry as new task in the task's details in the console's Logs, or use POST /api/v1/jobs/retry, spicyapi tasks retry or retryTask() in the SDK. A retry is a new task, checked and charged separately at the current price; the original stays as it was. Look at its errorCode first, because some failures, such as an invalid input, will fail the same way again. Uploaded files expire after one day, so an older task may need its file uploaded again. See Task commitment and retry.

Can I run many generations at once?

Yes, but there is no batch endpoint: submit each item as its own task, with its own idempotency key. Limit how many your program submits at a time, and prefer webhooks over constant polling. Your account may send up to 1,000 API requests per 10 seconds by default, and tasks that are already running do not count against that. What really limits how many run at once is your balance and spend caps. See Rate limits and the batch recipe.

Why did the model refuse my prompt, or return a toned-down result?

SpicyAPI does not require a content-mode request flag and does not perform per-request content review, but each model decides what it will produce — including its own real-person likeness, copyright, or safety checks. Failed or expired tasks normally release the full hold. Some content refusals are charged at the accepted quote only when the model page explicitly discloses this exception. Check settled and cost for the final charge. Some models instead return a toned-down result; that task has succeeded and is charged. Model pages on spicyapi.ai label the content limits we have measured for a model, so check them before choosing, or try a different model. A model refusal returns state: "failed" and errorCode: "content_rejected" (do not retry unchanged — branch separately from retryable timeout, rate_limited, or upstream_unavailable errors); when billed under a disclosed exception, settled is true and cost is positive. See Content and usage responsibility.

Which input and output file formats and size limits are supported?

Direct uploads through POST /api/v1/common/upload-url and POST /api/v1/files/{fileId}/commit accept images (image/jpeg, image/png, image/webp, image/gif) up to 10 MiB; inline Base64 data URIs accept JPEG, PNG, WebP, and GIF up to 1 MiB decoded (up to 8192×8192 px and 8,388,608 px per image, 16 images / 2 MiB JSON body per request). Video (video/mp4, video/webm, video/quicktime .mov converted to MP4 on commit) and audio (audio/mpeg, audio/wav) uploads support up to 90 MiB and 600 seconds. Where declared in a model's inputSchema, direct uploads also accept PDF, Office/iWork, plain text/Markdown documents, and 3D meshes (model/gltf-binary .glb, model/x-fbx, model/obj, model/stl) up to 90 MiB, plus .safetensors LoRA weights (application/octet-stream) up to 2 GiB. Generated outputs include raster images, MP4 video, audio, vector SVG, and 3D assets (.glb, .stl) depending on the model. Check x-ui.accept and x-ui.max_size_mb in the model's inputSchema, and see Media.

Text models

How do I use a chat or text model?

Text models answer straight away on the same connection instead of becoming tasks. Call them through the OpenAI, Anthropic or Google Gemini request format with your SpicyAPI key, using a text model ID from the live catalog (GET /api/v1/models?modality=text). To try one without code, open a chat model's Playground on spicyapi.ai. See Text and streaming.

Can I use the official OpenAI, Anthropic or Google libraries?

Yes; change only the address and the key. For the openai library, set the base URL to https://api.spicyapi.ai/v1. For the Anthropic and Google GenAI libraries, set it to https://api.spicyapi.ai, because they add the version part themselves. Every text model works with every one of these formats, whoever built it. See Text and streaming.

Is streaming supported?

Yes. Text models can send their reply word by word as server-sent events, for example with stream: true in the OpenAI format, or through the native POST /api/v1/jobs/stream. Each format signals the end of a stream in its own way. The CLI and MCP server do not stream chat replies; use one of the libraries above. See Text and streaming.

How are text models priced?

By tokens, the small pieces of text a model reads and writes. Input and output tokens have separate prices, and some models also have a lower price for cached input. Reasoning tokens are already included in the output count. The OpenAI-, Anthropic- and Gemini-format endpoints charge the price in force when a request is accepted and take no quote; if you need to confirm a price first, use the native jobs/quote followed by jobs/stream. Spend caps apply everywhere. See Quotes and compatibility.

My stream disconnected. Am I charged?

Usually yes. Closing the connection stops you receiving the text, but the model carries on to the end and the usage it reports is charged, including text you never received. Streamed text is not stored, so it cannot be fetched again later. If the stream fails on the model's side or ours, nothing is charged. To pay less per reply, lower the maximum output length instead of disconnecting. See Text and streaming.

Does every text model support tools, images and structured output?

No. What a model accepts is listed in its input schema in the catalog, whichever request format you use. A parameter the model does not support is refused with 400; it is never silently dropped while you are charged as usual. See Text and streaming.

Tools

Which tool should I use?
If you want to…Use
Try a model without installing anythingThe Playground on its page at spicyapi.ai
Generate by chatting with Claude, Cursor, VS Code or another assistantMCP server
Have an AI coding assistant write your integration the right wayAgent Skill, ideally with the MCP server
Type commands, save files or write a small scriptCLI
Chain models with other nodes in a visual graphComfyUI nodes
Build SpicyAPI into a Node.js or TypeScript programTypeScript SDK
Build it into a Python, Go, PHP or Java programPython SDK, Go SDK, PHP SDK, Java SDK
Use any other languageThe HTTP API, starting with the Quickstart
What do I need to install?

Nothing for the Playground. The TypeScript SDK, the CLI and the MCP server need Node.js 22.13 or newer, and the installer the Agent Skill uses asks for 22.20 or newer. The MCP server also needs an assistant app that supports MCP; to start paid tasks, that app must be able to show you a confirmation question. The CLI can run through npx without a permanent install. The other SDKs need only their own runtime: Python 3.11+, Go 1.23+, PHP 8.1+ or Java 17+. Any language that can send HTTPS requests can use the API directly.

Can an AI assistant spend my money without asking?

Not through the MCP server. Starting, retrying or destroying a task stops and asks you through your app, showing the price where there is one, and the assistant cannot answer that question itself. In apps that cannot ask, those actions simply fail and nothing is charged. Leave any "automatically accept" setting off for SpicyAPI. The Agent Skill is text only and cannot call anything by itself. As an extra safeguard, give each assistant its own API key with a low spend cap. See Costs, confirmation and safety.

Is there a Python, Go, PHP or Java SDK?

Yes, one for each: Python, Go, PHP and Java, alongside the TypeScript SDK. All five are MIT-licensed and implement the same workflow.

Each installs with its ecosystem's usual command: pip install spicyapi, go get github.com/spicyapi-ai/spicy-go, composer require spicyapi/spicyapi, and the ai.spicyapi:spicyapi-java dependency from Maven Central. Each guide walks from the install to your first result.

From any other language, call the HTTP API directly; the Quickstart includes complete Python and Go programs, and copyable reference clients are linked from the API reference next to the OpenAPI contract you can generate a client from. For text models, the official OpenAI, Anthropic and Google libraries work as they are.

Do the tools cost anything?

No. The TypeScript SDK, CLI, MCP server and Agent Skill are free, MIT-licensed npm packages, and the Python, Go, PHP and Java SDKs are free and MIT-licensed too. You only pay for the generations you run, at the same prices as everywhere else.

Where should I keep my API key when using these tools?

In the SPICY_API_KEY environment variable on your own computer or server. For the MCP server, it goes in your assistant app's user-level configuration file, never in a file inside a project. Never type it into a chat with an assistant, paste it into source code, commit it to a repository or put it in a screenshot. Using a separate key per tool makes it easy to see what each one spent and to disable just one. See Authentication.

Data and privacy

How long are my results kept?

Download links last about 20 minutes, and you can always ask for a new one while the file exists. Generated files are kept for about 14 days at most, uploaded files for one day and prompt text for 30 days. You can shorten those periods on the console's Data protection page, or for a single task. The task's billing record (ID, model, state, amount and times) is kept. Download anything you want to keep. See Retention and destruction.

Can I delete a task's content?

Yes, once the task has finished. Choose Destroy outputs on the task in the console's Logs, or use POST /api/v1/jobs/purge, spicyapi tasks purge or purgeTask(). It deletes the generated files, the stored result and the prompt text, and it cannot be undone. The billing record stays, and nothing is refunded. See Retention and destruction.

Can I remove a task from my history completely?

In the console's Logs, Remove from history hides a finished task from your log and clears its content. The records needed for billing and security remain, so the charge still appears in your billing history. The API has no way to delete the task record itself. See Retention and destruction.

Do you train models on my content?

No. Your prompts, reference images and results do not go into any training set. Uploaded inputs expire in 1 day, generated outputs in at most 14 days, and prompt text within 30 days — and you can dial retention shorter per task with X-Spicy-Retention or destroy task content immediately via POST /api/v1/jobs/purge. That promise is about SpicyAPI: the model that runs your request necessarily receives your prompt in order to generate the result. See Retention and destruction.

Does SpicyAPI review or filter what I send?

SpicyAPI does not require a content-mode request flag and does not perform per-request content review. Individual models may still decline or tone down some requests. You are responsible for how you use the service and its output, and some uses are never allowed on any model; read the Acceptable Use Policy and the Content Policy. See Content and usage responsibility.

Who on my team can see my tasks?

Every member of a team workspace can see task summaries and usage. Members with the owner, admin or developer role can also see task inputs and results and download the files. The owner's own balance, top-ups and payment details are never shown to other members. See Roles and permissions.

Can I download a copy of my account data?

Yes. On the console's Data protection page, Download your data gives you a JSON file with your profile, team roles, API key details, retained task data and billing records. It does not include key secrets or generated files, so download those results separately.

Who owns generated outputs, and can I use them commercially?

Your inputs stay yours. For generated outputs, SpicyAPI claims no ownership and passes through whatever rights it receives from the operator of the model you selected — no more than that, and without warranty. In many jurisdictions, purely AI-generated material without sufficient human creative input may not be eligible for copyright protection at all. Clearing rights for commercial use — including originality, resemblance to existing works, and third-party intellectual-property or likeness rights — rests with you. See section 7 of the Terms of Service.

Troubleshooting

Why do I get 401 or 403?

401 means the key was not accepted, and the message says why. Missing Authorization header means no key was sent, often because the environment variable is not set in the window you are using. API key format is not recognized means the value is not a SpicyAPI key, which always starts with sk-spicy-. Credentials are invalid or expired means the key was disabled or has expired, so create a new one. Retrying never helps.

403 means the key is valid but the request is not allowed. This account cannot call the API right now usually means your email address is not verified yet. 40301 means the key may not use this model, 40302 means your IP address is not on the key's allowlist, and 40303 means the service is not available in your region. See Errors.

Why do I get 402 with 40201 or 40202?

40201 means your available balance cannot cover the task's estimated cost: add funds, then send the same request again. 40202 means a spend cap was reached, and the message says which one. Raise it under API keys, or wait: daily caps restart at 00:00 UTC and monthly caps on the 1st, while lifetime caps never restart. Neither error creates a task or charges anything. See Billing.

Why do I get 429?

Too many requests in a short time. Wait for the number of seconds in the Retry-After header, then continue more slowly. Every native API request from your account counts, polling included, so checking tasks every second is the usual cause; wait longer between checks, or use webhooks. Requests over the limit are refused, not queued, and cost nothing. See Rate limits.

Why do I get 400?

The request does not match what the model accepts: a misspelled or unknown field, a missing required field, or a value outside the allowed range. One unknown field is enough. Read msg, compare your input with the model's inputSchema, or start from one of the model's examples, which are known to be valid. Invalid callback URL means callBackUrl is not a public HTTPS address. Nothing is charged. See Model catalog and schemas.

My task failed. What should I do?

Failed or expired tasks normally release the full hold. Some content refusals are charged at the accepted quote only when the model page explicitly discloses this exception. Check settled and cost for the final charge. Look at the task's errorCode. rate_limited, upstream_unavailable and upstream_failed are temporary, so wait and retry. invalid_asset means a reference file is no longer available, so upload it again first. invalid_request, unsupported_combination and content_rejected will fail again unless you change the input, the settings or the model. generation_failed and timeout may work on a second try, perhaps with a shorter duration or lower resolution. See Errors.

My webhook never arrived

Check these in order. The field is spelled callBackUrl and holds a public HTTPS address: localhost and private network addresses cannot receive webhooks, so poll instead while developing on your own computer. Your receiver checks signatures with the current signing key from the console's Webhooks page. It answers with a 2xx status within 15 seconds and without redirecting. Webhooks are sent only when a task finishes. That same page lists deliveries and lets you resend a failed one; in the meantime, read the task's state with recordInfo. See Webhooks.

My request timed out. Did the task start?

Maybe. A timeout does not prove the request was refused. Send exactly the same request again with the same Idempotency-Key and the same API key: if the task was created, you get it back instead of a second one, and you are not charged twice. Do not send it with a new key, and do not treat an empty task list as proof that nothing started. See Idempotency.

Still stuck?

On this page