canonical: https://jentic.com/apis/api-docs.hatz.ai/hatz-ai

# Api Docs Hatz Hatz AI REST API

Jentic publishes the only available OpenAPI specification for Hatz AI REST API, keeping it validated and agent-ready. Hatz AI exposes a chat-completions interface compatible with OpenAI-style request shapes and supports tool calling so agents can register functions and execute multi-turn reasoning. The API also provides a model-listing endpoint and a separate responses endpoint for higher-level orchestrated calls. Authentication is via an X-API-Key header or HTTP bearer token.

## For AI agents

Run chat completions with tool calling on Hatz AI models, list available models, and orchestrate multi-step responses through a single OpenAI-compatible endpoint.

## Scope

Does not handle image generation, audio transcription, or fine-tuning - use for chat-completion and tool-calling inference on Hatz AI hosted models only.

## Capabilities

- Generate chat completions on Hatz AI hosted models with system, user, and assistant message turns
- Register tool definitions in a request and let the model invoke them through structured tool_call outputs
- Discover the catalogue of available Hatz AI models with the /chat/models endpoint
- Orchestrate higher-level reasoning runs via the /openai/responses endpoint
- Authenticate either with an X-API-Key header for service accounts or a bearer token for user-scoped sessions

## Use cases

### OpenAI-Compatible Chat Backend Swap

Teams that already build against OpenAI's chat-completions schema can repoint to Hatz AI by changing the base URL and credential, keeping the same request body shape with messages and tools. Hatz AI's /chat/completions accepts the same role-based message turns and returns the same tool_call structures, so agent loops do not need to be rewritten. This makes Hatz AI a drop-in alternative for evaluating different model backends without refactoring application code.

Example prompt: Send a POST to /chat/completions with a system message, a user message, and a tools array describing one function, then parse the assistant's tool_call output

### Tool-Calling Agent Loop

Hatz AI returns structured tool_call outputs when the model decides a registered function should run, allowing agents to execute the call, append the result as a tool message, and re-prompt for the final answer. This pattern works for retrieval, data lookup, and action execution within a single conversation. The agent can repeat the loop until the model returns a normal assistant message with no further tool calls.

Example prompt: Run a chat completion with a tools array, detect a tool_call in the response, execute the tool, append the tool result as a message, and call /chat/completions again to get the final answer

### Model Discovery and Selection

Before issuing a chat completion an agent can call /chat/models to discover the active set of supported models on Hatz AI and pick one based on capability. This avoids hardcoding model names in agent code and keeps integrations resilient when Hatz AI rotates its hosted catalogue. The result is a deterministic selection step at the start of any agent run.

Example prompt: Call GET /chat/models, pick the model id whose name matches a configured capability tag, and pass that id into the next /chat/completions request

### Agent Integration via Jentic

An AI agent built on Jentic can search for the Hatz AI chat-completions operation by intent and execute it without storing the X-API-Key in agent context. Jentic's your Jentic One instance holds the credential and returns scoped access to the agent at execution time. This is useful when the same agent must call multiple LLM providers and credential isolation is a requirement.

Example prompt: Use Jentic search for 'send a chat completion to hatz ai', load the operation schema, then execute it with a messages array and the configured model id

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /chat/completions | Generate a chat completion with optional tool calling |
| GET | /chat/models | List available Hatz AI models |
| POST | /openai/responses | Run an orchestrated responses-style call |

## Key resources

- **Chat Completions** — Generate completions and run tool-calling loops via /chat/completions
- **Models** — List the active set of supported Hatz AI models via /chat/models
- **Responses** — Run higher-level orchestrated reasoning calls via /openai/responses

## Why Jentic

- **Setup:** Wiring the Hatz AI REST API by hand means choosing between its API key and bearer auth, targeting the v1 host, and mapping the chat-completion and tool-calling routes yourself. Through Jentic you install once, import Hatz AI from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** Hatz AI addresses inference through the request body rather than resource ids in the URL path, so you limit the agent to the operations it needs, such as chat completions or listing available models. The responses operation is separate and is only available if you include it in the allowed set.
- **Credential handling:** Your Hatz AI API key or bearer token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'send a chat completion to Hatz AI' or 'list Hatz AI models', and Jentic returns the matching operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **OpenAI API** — OpenAI's chat-completions and tools API; the schema Hatz AI is compatible with
- **Anthropic Messages API** — Anthropic's Claude messages API for chat and tool use
- **Groq API** — Groq's low-latency inference for hosted open models
- **Hugging Face Inference API** — Run open-weights models for tasks Hatz AI does not cover

## FAQ

### Why is there no official OpenAPI spec for Hatz AI REST API?

Hatz AI does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Hatz AI REST API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Hatz AI REST API use?

The API accepts either an X-API-Key header or an HTTP bearer token. When called through Jentic the credential is held in your Jentic One instance and never enters agent context, only a scoped execution token is granted at call time.

### Can I use tool calling with the Hatz AI REST API?

Yes. POST /chat/completions accepts a tools array and the response contains tool_call entries when the model decides to invoke a function. The agent executes the function, appends the result as a tool message, and re-calls /chat/completions to obtain the final assistant turn.

### What are the rate limits for the Hatz AI REST API?

The OpenAPI spec does not declare explicit rate limits. Treat the API as standard HTTPS and respect any 429 responses with exponential backoff; check Hatz AI's account dashboard for current quotas.

### How do I run a chat completion on Hatz AI through Jentic?

Install the Jentic SDK with pip install jentic, search for 'send a chat completion to hatz ai', load the /chat/completions operation, and execute it with your messages array and chosen model id. Run it through Jentic One, the self-hosted execution layer to get a Jentic agent key.

### How do I discover which models are available on Hatz AI?

Call GET /chat/models to retrieve the catalogue of currently supported model ids. Use the returned id as the model field in subsequent /chat/completions calls so the integration is not tied to a hardcoded name.

### Can I limit what my agent is allowed to do with the Hatz AI REST API?

Yes. Because you run Jentic One yourself, your own rules decide which Hatz AI operations the agent may call, so you can allow just chat completions on /chat/completions while withholding model listing on /chat/models. The separate /openai/responses operation is only reachable when you add it to the allowed set. Hatz AI targets inference through the request body rather than resource ids in the URL, so scoping is done per operation, and your stored API key or bearer token is injected at call time without entering the agent's context.
