Hatz AI REST API

Explore Hatz AI's API reference. Hatz AI provides software tools and libraries to accelerate development.

The API provides access to all models on the Hatz AI platform and includes two main LLM interface patterns:

  • Hatz-native Chat Completions (/v1/chat/completions) with the Hatz harness, recursive tool calling, and server-side tools.
  • OpenAI-compatible Responses (/v1/openai/responses) for clients that expect OpenAI Responses wire format.
  • Anthropic-compatible Messages (/v1/anthropic/messages) for clients that expect Anthropic Messages wire format.

For OpenCode and other OpenAI-provider clients, start with OpenAI Responses. For Claude Code, Anthropic SDK clients, and Anthropic-provider clients, start with Anthropic Messages.

We also do have a TypeScript SDK, where you can contact the Hatz Team for access.

Base URL

The base URL for the Hatz REST API is:

https://ai.hatz.ai/v1

Gateway-specific client base URLs:

Client type Base URL Notes
Hatz REST and Hatz-native Chat Completions https://ai.hatz.ai/v1 Use paths such as /chat/completions, /chat/models, /workflows/run, and /usage/*.
OpenAI-compatible clients https://ai.hatz.ai/v1/openai SDK clients append the compatible route, such as /responses.
Anthropic-compatible clients https://ai.hatz.ai/v1/anthropic Anthropic SDK clients append /v1/messages.

For error triage and request IDs, see API Troubleshooting.

Authentication

The Hatz API uses API Keys for authentication. Pass your key in the X-API-Key header — it works on every endpoint:

curl 'https://ai.hatz.ai/v1/chat/models' \
  -H "X-API-Key: $HATZ_API_KEY"

The OpenAI-compatible and Anthropic-compatible endpoints also accept the same API key as a Bearer token, for clients that can only send an Authorization header (for example the OpenAI and Anthropic SDKs, OpenCode, AnythingLLM, and Jan):

Endpoint X-API-Key Authorization: Bearer
OpenAI Responses (/openai/responses) Yes Yes
Anthropic Messages (/anthropic/messages) Yes Yes
Anthropic Token Count (/anthropic/messages/count_tokens) Yes Yes
All other endpoints Yes No

On all other endpoints the Authorization header is reserved for Hatz user-session tokens, so an API key sent as Authorization: Bearer returns 401 Unauthorized. If your client can only send Bearer tokens, point it at the compatibility endpoints above.

Unsupported public API-key auth forms include query-string API keys, Basic auth, cookie/session auth for external integrations, and raw keys in request bodies.

Each API Key is scoped to a specific user, so users can make their own API Key. The API Key should provide access to the apps the user has access to.

You can generate API Keys on the platform on the Hatz Admin Dashboard by navigating to the settings tab, however you can contact the Hatz team at help@hatz.ai to request an API Key for your user.

Example Bearer call (compatibility endpoints only):

curl 'https://ai.hatz.ai/v1/openai/responses' \
  -H 'Authorization: Bearer '"$HATZ_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model": "gpt-5.2", "input": "Write a 2 sentence summary of SOC 2."}'

Request IDs

Hatz API responses include an X-Request-ID response header. You can also send your own X-Request-ID header and Hatz will use it for that request. If you send your own request ID, use a short opaque value and do not include emails, tenant names, prompts, secrets, customer records, or other sensitive data. Include the response request ID, timestamp, endpoint, sanitized error body, SDK/client, and business impact when contacting Support.