> ## Documentation Index
> Fetch the complete documentation index at: https://docs.antarah.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API reference

> Base URL, authentication, and conventions shared by every endpoint.

```
https://api.antarah.dev/v1
```

The machine-readable spec is at [`https://api.antarah.dev/openapi.json`](https://api.antarah.dev/openapi.json) (OpenAPI 3.1, no authentication).

| API | Endpoints | Credential |
| - | - | - |
| Inference | Chat Completions, Responses, Messages, count tokens, Models, Credits | Project API key |
| Policy API | `/v1/organization/policies…`, effective policies | Admin API key |
| Admin API | Organization, projects, project and Admin API keys, balance, spend limits, usage, costs | Admin API key |
| Public | `GET /v1/plans`, `GET /openapi.json` | None |

See [Authentication](https://docs.antarah.dev/authentication.md) for the keys and their permissions.

## Conventions

| Topic | Rule |
| - | - |
| Format | JSON in and out, `snake_case` fields. Streams are `text/event-stream` |
| IDs | A prefix plus 32 hex characters, sortable by creation time: `org_`, `proj_`, `key_`, `pol_`, `polv_`, `dec_`, `req_`, `chatcmpl_`, `resp_`, `msg_` |
| Timestamps | Unix seconds (`created_at`). `expires_at` on API key create takes an RFC 3339 string; time filters (`start_time`, `end_time`, `since`, `until`) take Unix seconds |
| Money | USD as decimal strings (`"12.50"`, `"0.000125"`). `GET /v1/credits` uses JSON numbers |
| Missing values | Optional fields are present as `null`, never left out |
| Unknown fields | Policy and Admin APIs reject them (`422 validation_error`). Inference ignores unknown fields inside messages, content parts, and tools, and rejects unknown top-level fields (`400 unsupported_parameter`) |
| Query arrays | Repeat the key: `?project_ids=proj_a&project_ids=proj_b` |
| Text length | Counted in Unicode code points |
| Request IDs | Every response has `x-request-id` and `request-id` |

## Pagination

Lists return `{"object": "list", "data": [...], "has_more", "first_id", "last_id"}`, newest first (projects: oldest first; models: catalog order). Pass `limit` (1–100, default 20) and `after=<last_id>` for the next page.

Usage and cost endpoints return time buckets in ascending order: `{"object": "page", "data": [...], "has_more", "next_page"}`. Pass `start_time` (required), `end_time`, `limit`, and `page=<next_page>`.

## Idempotency

Creates require an `Idempotency-Key` header; every other write accepts one. See [Idempotency](https://docs.antarah.dev/guides/idempotency.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.