Overview
API reference
Base URL, headers, conventions and every endpoint.
The Astorie API is a JSON HTTP API. These pages list every endpoint with its fields. For the ideas behind them, start with How the API works.
Base URL
https://astorie.ai/api/gateway/v1Authentication
Send your key as a bearer token on every request. See Authentication.
Authorization: Bearer ast_gw_...Endpoints
| Endpoint | Scope | |
|---|---|---|
GET /v1/models | models:read | List models |
GET /v1/capabilities | models:read | Get model capabilities |
POST /v1/quotes | quotes:create | Create a quote |
GET /v1/quotes/{id} | quotes:read | Get a quote |
POST /v1/jobs | jobs:create | Create a job |
GET /v1/jobs | jobs:read | List jobs |
GET /v1/jobs/{id} | jobs:read | Get a job |
POST /v1/jobs/{id}/cancel | jobs:cancel | Cancel a job |
POST /v1/files | files:write | Create a file |
GET /v1/balance | wallet:read | Get balance |
GET /v1/ledger | wallet:read | List ledger entries |
Headers
| Header | Direction | Meaning |
|---|---|---|
Authorization | Request | Your API key, as Bearer ast_gw_.... |
Content-Type | Request | application/json on every POST with a body. |
Idempotency-Key | Request | Required on POST /v1/jobs and POST /v1/files. |
X-Request-Id | Response | Unique per request. Quote it to support. |
X-Idempotent-Replay | Response | true when the response came from an earlier request with the same key. |
Retry-After | Response | Seconds to wait before retrying a 429 or 503. |
Conventions
- Fields are
snake_case. Responses carryapi_version: "v1"and anobjecttype. - Money is a decimal string with six places, such as
"0.080000". Never send a number. The exception is the display prices inGET /v1/models, which drop trailing zeros. - Times are RFC 3339 in UTC.
- A resource that doesn't exist and one that belongs to another account both return
404 not_found. - New fields and enum values can be added without notice. Ignore ones you don't know.
Pagination
List endpoints take limit (1 to 100) and return data, has_more and next_cursor. Pass next_cursor back as cursor for the next page. The ledger pages by sequence number instead. See List ledger entries.
Errors
Errors return an HTTP status and a body with error.code, error.message, error.retryable, error.details and request_id. The full list is on Errors.