Direct HTTP access to inference shell.
Base URL
1https://api.inference.shPath prefix
All routes also work under an optional /v1/ prefix. The prefix is stripped internally — handlers are registered at the root path.
1# Equivalent requests2curl https://api.inference.sh/tasks/task_abc123 -H "Authorization: Bearer inf_your_key"3curl https://api.inference.sh/v1/tasks/task_abc123 -H "Authorization: Bearer inf_your_key"Use whichever form matches your client or OpenAPI tooling. Official SDKs and the belt/infsh CLIs call the root paths (without /v1/).
Authentication
All requests require an API key in the Authorization header:
1Authorization: Bearer inf_your_api_keyContent Type
1Content-Type: application/jsonAPI version
Send X-API-Version: 2 to use the modern response format. The official JavaScript and Python SDKs, plus the belt / infsh CLIs, send this header automatically on API calls.
| Version 1 (default) | Version 2 (X-API-Version: 2) | |
|---|---|---|
| Success body | Wrapped: { "success": true, "status": 200, "data": { ... } } | Bare resource DTO (same fields as data in v1) |
| Error body | Wrapped: { "success": false, "status": 4xx, "error": { "code", "message" } } | RFC 9457 application/problem+json |
| Requirements (412) | { "satisfied": false, "errors": [...] } | Same (not wrapped) |
Version 2 success example (task from POST /run):
1{2 "id": "task_abc123",3 "status": 10,4 "output": { "image": { "uri": "https://..." } }5}Version 2 error example (401):
1{2 "type": "https://api.inference.sh/errors/unauthorized",3 "title": "Unauthorized",4 "status": 401,5 "detail": "Invalid or missing API key"6}Version 1 error example (same request without the header):
1{2 "success": false,3 "status": 401,4 "error": {5 "code": "unauthorized",6 "message": "Invalid or missing API key"7 }8}REST examples in this section use version 2 unless noted otherwise. Add the header to curl:
1curl https://api.inference.sh/tasks/task_abc123 \2 -H "Authorization: Bearer inf_your_key" \3 -H "X-API-Version: 2"Error Responses
With X-API-Version: 2, errors use Content-Type: application/problem+json and the type, title, status, and detail fields shown above. The type URI ends with the error code (for example .../errors/not_found).
Some errors include an optional meta extension member with structured context — for example entitlement errors (limit_exceeded, feature_not_available) attach resource, limit, current, upgrade_available, and optional addon plan fields. See Entitlements API — Error metadata.
Without the header, errors use the version 1 wrapper with error.code, error.message, optional error.meta (same structured fields as version 2), and optionally error.suggestions (array of suggested namespace/name refs on some not_found responses, such as unknown app lookups).
Error Codes
| Code | HTTP | Description |
|---|---|---|
unauthorized | 401 | Invalid or missing API key |
forbidden | 403 | Insufficient permissions |
not_found | 404 | Resource not found |
invalid_request | 400 | Malformed request |
rate_limited | 429 | Too many requests |
internal_error | 500 | Server error |
Billing and plan limits
Two kinds of billing errors can block API calls:
| Kind | Typical codes | What to check |
|---|---|---|
| Plan limits | limit_exceeded (402), feature_not_available (403) | Subscription tier caps — API keys, storage, concurrent tasks, feature flags |
| Prepaid balance | payment_required (402) | Credits for task and agent runs |
Inspect current usage programmatically with GET /entitlements/usage. List entitlement rows (limits and sources) with GET /entitlements. See Entitlements API for response formats and error metadata.
Workspace modals
In the inference shell app, entitlement errors with upgrade_available: true open an upgrade modal instead of only surfacing a toast:
| API error | Modal |
|---|---|
limit_exceeded or feature_not_available (tier cap) | Upgrade modal — lists self-serve plans above your current tier |
feature_not_available with addon_plan_id | Add-on purchase modal — shows addon name, price, and subscribe - $X/mo CTA that routes to the add-ons page |
payment_required (402 without upgrade_available) | Top-up modal — add prepaid credits |
The upgrade modal shows the API detail message (or which resource requires a higher plan). For limit_exceeded, it also shows current usage / plan cap (for example 3 / 5) when the cap is greater than zero. A 0 cap means the feature is disabled on your tier — the modal omits a usage line instead of showing 0 / 0.
Each listed plan shows monthly price, included credits, and key limits. The recommended badge marks the cheapest plan that resolves the blocked resource (unlimited, a higher numeric cap, or an enabled boolean feature). Select a plan or View all plans to open Subscription.
When the error includes addon_plan_id, the modal shows a single add-on card with a subscribe - $X/mo button that routes to Add-ons — the same purchase flow as the add-ons settings page (Stripe Checkout via POST /subscription/addon). Most add-ons do not require a base subscription; some set required_plan_ids on the plan.
Direct links: Pricing (browse plans) · Billing (credits) · Subscription (manage plan) · Add-ons (purchase add-ons)
Rate Limits
| Endpoint | Limit |
|---|---|
| Run task | 100/minute |
| Get task | 1000/minute |
| Upload file | 50/minute |
Response headers:
1X-RateLimit-Remaining: 952X-RateLimit-Reset: 16400000003Retry-After: 60Some endpoints (for example magic link send when throttled by IP) return HTTP 429 with a Retry-After header (whole seconds). Browser clients can read it — the API exposes Retry-After in CORS Access-Control-Expose-Headers.
OpenAPI
Download the generated route catalog:
1GET https://api.inference.sh/openapi.jsonOpenAPI 3.1 document listing public paths, methods, and schemas. Useful for client generation and discovering routes not yet covered in these guides. No authentication required.
Cursor pagination
Most list endpoints (GET /tasks, GET /skills, POST /apps/list, GET /chats/:id/messages, and others) use the same cursor-list shape. Send parameters as query strings on GET or in a JSON body on POST …/list.
| Field | Type | Description |
|---|---|---|
limit | integer | Page size (default varies by endpoint — often 10 or 50). Pass -1 to return all matching items in one response without pagination. |
cursor | string | Opaque cursor from next_cursor or prev_cursor (ignored when limit=-1) |
direction | string | forward (default) or backward (ignored when limit=-1) |
sort | array | Sort orders, for example [{ "field": "created_at", "dir": "desc" }] |
filters | array | Filter expressions (field, operator, value) |
search | object | Full-text search (term, fields, …) where supported |
Response shape
| Field | Type | Description |
|---|---|---|
items | array | Resources for this page (or all matches when limit=-1) |
next_cursor | string | Cursor for the next page |
prev_cursor | string | Cursor for the previous page |
has_next | boolean | More results after this page |
has_previous | boolean | Results before this page |
items_per_page | number | Items in this response |
total_items | number | Total matching items |
Responses may include RFC 8288 Link headers (rel="next", rel="prev") with the same cursors.
Full dumps (limit=-1)
Pass limit=-1 on any cursor-paginated list endpoint to skip pagination and return matching rows in one response (capped at 10,000 rows). Sort and filters still apply; cursor and direction are ignored. has_next is false — treat items as the complete result set when the match count is under the cap.
Use this for exports, migrations, or debugging on smaller datasets. Prefer normal cursor pagination for UI scroll-back and tables that may exceed 10,000 rows.
1curl "https://api.inference.sh/tasks?limit=-1&filters=%5B%7B%22field%22%3A%22status%22%2C%22operator%22%3A%22eq%22%2C%22value%22%3A10%7D%5D" \2 -H "Authorization: Bearer inf_your_key" \3 -H "X-API-Version: 2"Endpoints
- Tasks — Run apps, status, logs, timings, telemetry, cancellation, webhooks, cost
- Engines — Private engine list, drain, update, stop
- Files — Upload files
- Agents — Agent chat API
- Publications — Publish agents for embedding (
POST /publications) - Embed — Anonymous chat API for published agents
- Triggers — Cron and webhook automation (run agents, apps, flows)
- Skills — Manage and access skills
- Knowledge — Manage knowledge entries
- Pages — Read CMS pages (docs, blog, landing pages)
- Search — Search apps, skills, knowledge, and pages
- Entitlements — Plan limits, usage, and feature flags
- Streaming — SSE endpoints
- Billing · Subscription — Credits and plan management
- Magic link sign-in · Device authorization — Workspace and CLI login