Documentation menu

API reference

Every operation of the management API, generated from its OpenAPI document.

What your backend calls to manage what the dashboard manages, at the level of a project and below: the environment's keys, its customers and their provider keys, wallets, credits, top-ups and auto-refill, its usage, its webhook endpoints and events, trace exports, its Stripe connection, its gateway settings, its own provider keys and catalog models; and, with a project key, the project itself, its environments, its keys, its audit log and its billing.

  • Keys. Two keys call this API. An environment's key with the management scope (hx_sk_…) acts in its own environment. A project key (hx_proj_…) manages its project and every environment of it, with the permissions of its role (admin or member), never the organization's own settings, members or other projects; the gateway never accepts it.
  • Environment. An environment's key decides the environment every call reads and changes. A project key names it in the x-hixel-environment: env_… header on every environment's endpoint: without it the call is invalid_request (400, environment_required); naming an environment outside the key's project, an archived one or an unknown one is not_found (404, environment_not_found), alike, and so is an environment's key naming another environment than its own. A resource of another environment, project or organization reads as not_found.
  • Roles and scopes. Every operation states what it needs of its key: x-required-scope (an environment's key needs the management scope) and x-required-role (a project key's member role reads; admin reads and changes everything at the project level and below). An endpoint only a project key may call (the project's own, PATCH /v1/gateway and the writes of /v1/provider_keys) answers an environment's key with permission_denied (403, project_key_required), and a project key whose role is short of an operation's with role_not_allowed. Nothing of the organization's own (its settings, members, other projects) is in this API.
  • Customers are named by your own id for them, external_id, in paths such as /v1/customers/{external_id}/wallet.
  • JSON bodies with snake_case names. Every amount is an integer number of micro-USD (millionths of a US dollar) and every token count an integer, both as decimal strings ("1500000" is 1.50 USD), never JSON numbers. Instants are RFC 3339 strings in UTC.
  • Lists answer {"data": [...], "next_cursor": …}: pass next_cursor back as cursor, with the same filters, for the next page; it is null on the last page. limit is 1 to 100, 50 by default.
  • Retries. Writes accept an Idempotency-Key header, so a retried write runs once: per environment on an environment's endpoints, per project on the project's own.
  • Errors answer {"error": {"type", "code", "message", "param"}}, the status fixed by type. Branch on code, never on message.

Inference (/v1/chat/completions, /v1/responses, /v1/messages, …) is served on the same host by the gateway and is not part of this document.

The management API is served at https://api.hixel.dev, under /v1. Its OpenAPI 3.1 document is at https://api.hixel.dev/v1/openapi.json. Every call below shows a curl command and the same call with the Node SDK. Bodies and responses use snake_case names, amounts are strings of micro-USD (Amounts), every list is a page, a delete answers 204 with no body, every response carries x-hixel-request-id, and failures use the error envelope.

Two kinds of key call it (Authentication). An environment key (hx_sk_…, with the management scope) acts in its own environment. A project key (hx_proj_…) calls the project's own sections below, and every environment section too, naming the environment in x-hixel-environment: env_…. Each operation says which it takes; the curl samples use $HIXEL_API_KEY for an environment key and $HIXEL_PROJECT_KEY for a project key.

SectionWhat it covers
SystemDiagnostics of the control plane itself; no account's data and no key needed.
ProjectThe project the calling project key belongs to.
Project keysThe keys of the calling project key's project.
EnvironmentsThe environments of the calling project key's project.
Audit logWhat was done in the calling project key's project, and by whom.
Project billingWhat the calling project key's project cost your organization with the gateway (the provider cost of the requests on the platform's provider key), and whether its environments are let through.
KeysThe keys of the calling key's environment.
CustomersYour customers in the calling key's environment, each named by your own id for it (external_id), and the provider keys they bring.
Customer portalWhat a customer's admin governs in the hosted portal, which your backend can read and change too.
GatewayHow the environment's requests are routed, limited, paid for, checked and cached.
Provider keysYour own provider keys for the environment.
CatalogThe models offered to the calling key's environment through the platform's own provider keys, and their prices.
WalletsCustomers' prepaid balances and their ledgers.
Wallet settingsThe calling key's environment's wallet settings.
UsageEvery request the environment's gateway served, as the usage log recorded it, and its analytics.
Webhook endpointsWhere the calling key's environment's events are sent.
EventsWhat happened in the calling key's environment, as webhook events.
Trace export destinationsThe calling key's environment's recorded requests sent, as OpenTelemetry spans over OTLP/HTTP (JSON), to your own observability tools (Langfuse, Datadog, Honeycomb, Grafana, an OpenTelemetry Collector).
Stripe connectionThe calling key's environment's connection to your own Stripe account.
Top-upsCustomers buying credit through Stripe Checkout on the environment's Stripe connection.
Auto-refillCharging a customer's saved payment method off-session when its balance runs low, within a monthly cap.
PaymentsThe environment's payments, top-ups and auto-refills together.
Webhook eventsEvery event a webhook endpoint can receive, and its payload.