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 a key in the dashboard 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.

3. Create a media generation

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": "veo3.1-fast", "input": { "prompt": "A cinematic aerial shot of a lighthouse at dawn" } }'

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/019ca881-9503-7270-a560-f00fc2b15785 \ -H "Authorization: Bearer $API_STOCK_KEY"

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://storage.api-stock.com/video.mp4", "fileType": "video" }], "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.