Images

Generate and edit images through the OpenAI-compatible images API, served from https://api.akashml.com/v1. These endpoints are priced per request rather than per token — see Pricing for details.

Create a message (Anthropic shape)

Anthropic-compatible Messages endpoint. Internally translates to the upstream OpenAI-compatible inference path. **Streaming.** When `stream: true` is set, the response content type switches to `text/event-stream` and Anthropic-shaped events are emitted. Event types: - `message_start` — message envelope with id, model, role, usage. - `content_block_start` — start of a content block (text, tool_use, thinking). - `content_block_delta` — incremental content (text delta, input_json_delta, thinking_delta). - `content_block_stop` — end of a content block. - `message_delta` — running stop_reason / usage updates. - `message_stop` — terminal event. - `ping` — keep-alive. - `error` — terminal error event (see error type mapping below). **Model ID aliasing.** Slashes in upstream model IDs are aliased with `--` — pass `anthropic--claude-3-5-sonnet` to target `anthropic/claude-3-5-sonnet`. **Error response shape.** All non-2xx responses use `{ type: "error", error: { type, message } }`. Status → `error.type` mapping: | Status | `error.type` | |--------|---------------| | `400` | `invalid_request_error` | | `401` | `authentication_error` | | `403` | `permission_error` | | `404` | `not_found_error` | | `413` | `request_too_large` | | `429` | `rate_limit_error` (response includes `Retry-After` header) | | `500` | `api_error` | | `503` / `529` | `overloaded_error` |

Edit image

Edits an existing image based on a text prompt. Accepts `multipart/form-data` with the original image attached as `image`. **Response headers** - `Inference-Id` — Unique ID for this request. Include this when contacting support. **Error codes** | Status | Meaning | |--------|---------| | `402` | Insufficient credits | | `429` | Rate limited | | `504` | No backend available | | `529` | No healthy backends are available for the requested model |