Skip to Content
DocumentationQuick start

Quick start

API Stock gives every model one API key and one prepaid balance. Media models run asynchronously; chat models return an OpenAI- or Anthropic-compatible response directly.

1. Create an API key

Create an API key and keep it on your server:

export API_STOCK_KEY="sk-…"

Send it with every request as Authorization: Bearer sk-….

2. Choose a model

Open Models, choose a model, and copy its minimal request. The runtime list is also available from GET /api/v1/catalog.

Check the current request price for your model and parameters on the pricing page.

3. Create a media generation

Before sending the request, check your balance. Your balance must cover the request price. Creating an API key does not add funds. Top up if needed; the available payment methods, minimum top-up and final amount are shown at checkout.

curl -X POST https://api.api-stock.com/api/v1/generation/create \ -H "Authorization: Bearer $API_STOCK_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "nano-banana-2.1", "input": { "prompt": "A blue ceramic bowl on pale linen, soft daylight", "size": "1:1", "resolution": "2K" } }'

The request is charged and queued immediately:

{ "code": 200, "data": { "taskId": "019ca881-9503-7270-a560-f00fc2b15785", "status": "not_started", "createdAt": "2026-08-22T12:00:00.000Z" } }

4. Retrieve the result

curl "https://api.api-stock.com/api/v1/task/status/$TASK_ID" \ -H "Authorization: Bearer $API_STOCK_KEY"

Save the returned data.taskId as TASK_ID before running the status request. Space out requests while the task is queued or processing. Wait until status is finished, failed, or expired. Successful media tasks return files; text and data actions return output.

{ "code": 200, "data": { "taskId": "019ca881-9503-7270-a560-f00fc2b15785", "status": "finished", "files": [{ "fileUrl": "https://s3.api-stock.com/image.png", "fileType": "image" }], "createdTime": "2026-08-22T12:00:00.000Z" } }

For production, add a top-level webhook URL. See Tasks and webhooks.

Chat models

OpenAI-compatible models use POST /api/v1/chat/completions; Anthropic models use POST /api/v1/messages. They do not create tasks. Start with the OpenAI protocol or Anthropic protocol.

Balance and pricing

GET /api/v1/user/me returns the balance in integer USD cents. See the pricing page for current rates. A media request is debited when queued and refunded automatically if the generation ends in failed.