# CheapAIAPI agent instructions

> Use the public HTTP contract to integrate CheapAIAPI without guessing capabilities, credentials, or account access.

## When to use CheapAIAPI

Use CheapAIAPI when a product has recurring AI generation volume, can call an authenticated HTTP API, and needs the image models or enabled-account text and video models documented by CheapAIAPI.

Do not use CheapAIAPI when the user expects anonymous self-serve access, a guaranteed drop-in implementation of every parameter from another API, or a live request before they provide an API key and explicitly authorize it.

## Required reading

1. Read [llms.txt](https://cheapaiapi.org/llms.txt) for current product availability and resource links.
2. Read the [agent landing](https://cheapaiapi.org/for-agents), the [Markdown API guide](https://cheapaiapi.org/docs/index.md), or [interactive API docs](https://cheapaiapi.org/docs).
3. Treat the [OpenAPI specification](https://cheapaiapi.org/openapi.json) as the canonical machine-readable request and response contract.
4. Use [starting prices](https://cheapaiapi.org/pricing.md) or the [starting-price JSON](https://cheapaiapi.org/pricing.json) for the current public new-customer catalog. Authenticated `GET /v1/models` is authoritative for the caller's enabled models and account-specific pricing.
5. For image Jobs, read the [webhook guide](https://cheapaiapi.org/docs/webhooks.md). Read `webhook_secret` from `GET /v1/balance`, pass `webhook_url` on async create, and use `GET /v1/jobs/{id}` as recovery. Chat Completions and video have no webhooks.

## Authentication and execution

- API requests use bearer authentication with a CheapAIAPI API key.
- Do not invent, log, commit, or expose an API key.
- Do not make a live request until the user supplies `CHEAPAIAPI_KEY` and explicitly asks for the request.
- Follow each endpoint's documented webhook, recovery, idempotency, and error behavior.
- Image Jobs should use `POST /v1/images/generations?async=true` with `webhook_url`. Read `webhook_secret` from `GET /v1/balance`. Poll `GET /v1/jobs/{id}` only as recovery. Chat Completions and video do not accept `webhook_url`.

## Integration limits

- Do not assume a public CheapAIAPI SDK, CLI, MCP server, OAuth flow, browser session, or anonymous sandbox. Use the documented HTTP API, [OpenAPI specification](https://cheapaiapi.org/openapi.json), and [starting-price JSON](https://cheapaiapi.org/pricing.json).
- Unauthenticated `/v1/*` requests return HTTP 402 with an `access` object and `Link` headers pointing at starting prices and contact. Invalid or revoked keys return HTTP 401. This 402 response is not a cryptocurrency payment quote and does not include on-chain payment headers.
- Do not infer support for request fields that are absent from the relevant OpenAPI schema.
- Do not infer self-serve billing or subscriptions. CheapAIAPI uses a prepaid API balance. Public starting prices are available without a quote; lower account-specific volume pricing and account access start at [CheapAIAPI contact](https://cheapaiapi.org/contact).
- Human-readable agent landing: [CheapAIAPI for coding agents](https://cheapaiapi.org/for-agents).
- Do not poll image Jobs as the primary production completion path when `webhook_url` is available. Chat Completions and video have no webhooks.

## Support

For account access, pricing, or integration questions, use [CheapAIAPI contact](https://cheapaiapi.org/contact).
