Hush AI API Documentation
OpenAI-compatible chat completions API. Your data never leaves hardware we own.
Authentication
All API requests require an API key passed in the Authorization header as a Bearer token.
Authorization: Bearer YOUR_API_KEY
Get your API key by creating an account. API keys are available on all plans.
Keep your key secret. Do not expose it in client-side code, public repositories, or browser requests. Use it only in server-side code or secure environments.
Base URL
https://hush-ai.uk/v1
All endpoints are prefixed with this base URL. The API accepts application/json requests and returns application/json responses (or text/event-stream for streaming).
Create chat completion
POST /v1/chat/completions
Creates a chat completion for the given messages. This is the primary endpoint and follows the OpenAI chat completions format exactly.
Request body
| Parameter | Type | Description | |
|---|---|---|---|
| model | string | Required | Model ID to use: omega, prism, or lambda. |
| messages | array | Required | Array of message objects. Each has role (system, user, or assistant) and content (string). |
| temperature | number | Optional | Sampling temperature, 0 to 2. Higher values make output more random. Default: 1. |
| max_tokens | integer | Optional | Maximum number of tokens to generate in the response. |
| top_p | number | Optional | Nucleus sampling. Consider tokens with top_p probability mass. Default: 1. |
| stream | boolean | Optional | If true, partial message deltas are sent as server-sent events. Default: false. |
| stop | string or array | Optional | Up to 4 sequences where the API will stop generating. |
| frequency_penalty | number | Optional | Penalise tokens based on frequency in the text so far, −2.0 to 2.0. Default: 0. |
| presence_penalty | number | Optional | Penalise tokens based on whether they appear in the text so far, −2.0 to 2.0. Default: 0. |
Example request
curl https://hush-ai.uk/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "omega", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain GDPR Article 28 in one paragraph."} ], "temperature": 0.7, "max_tokens": 256 }'
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1722100000,
"model": "omega",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "GDPR Article 28 governs the relationship between..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 95,
"total_tokens": 123
}
}Response fields
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for this completion. |
| object | string | Always chat.completion. |
| created | integer | Unix timestamp of when the completion was created. |
| model | string | The model used for this completion. |
| choices | array | Array of completion choices. Each contains index, message (with role and content), and finish_reason. |
| usage | object | Token usage: prompt_tokens, completion_tokens, total_tokens. |
Streaming responses
Set "stream": true in your request to receive partial responses as server-sent events (SSE). The response uses Content-Type: text/event-stream.
Example streaming request
curl https://hush-ai.uk/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -N \ -d '{ "model": "omega", "messages": [{"role": "user", "content": "Hello"}], "stream": true }'
Stream format
Each event is a JSON object prefixed with data: . The stream ends with data: [DONE].
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1722100000,"model":"omega","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]} data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1722100000,"model":"omega","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]} data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1722100000,"model":"omega","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]} data: [DONE]
Handling streams in Python
from openai import OpenAI client = OpenAI( base_url="https://hush-ai.uk/v1", api_key="YOUR_API_KEY" ) stream = client.chat.completions.create( model="omega", messages=[{"role": "user", "content": "Hello"}], stream=True ) for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")
Handling streams in Node.js
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://hush-ai.uk/v1", apiKey: "YOUR_API_KEY", }); const stream = await client.chat.completions.create({ model: "omega", messages: [{ role: "user", content: "Hello" }], stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content || ""); }
List models
GET /v1/models
Returns the list of available models.
Example request
curl https://hush-ai.uk/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"Response
{
"object": "list",
"data": [
{"id": "omega", "object": "model", "owned_by": "hush-ai"},
{"id": "prism", "object": "model", "owned_by": "hush-ai"},
{"id": "lambda", "object": "model", "owned_by": "hush-ai"}
]
}For full model specifications, see the models page.
Error codes
The API returns standard HTTP status codes. Error responses include a JSON body with error.message and error.type.
{
"error": {
"message": "Invalid API key provided.",
"type": "authentication_error",
"code": "invalid_api_key"
}
}| Code | Meaning | What to do |
|---|---|---|
| 400 | Bad request: malformed JSON or missing required fields. | Check your request body. Ensure model and messages are present and correctly formatted. |
| 401 | Unauthorised: missing or invalid API key. | Check the Authorization header. Ensure the key starts with the correct prefix and has not been revoked. |
| 403 | Forbidden: the key does not have permission for this resource. | Contact support. |
| 404 | Not found: the endpoint or model does not exist. | Check the URL and model ID. Valid models: omega, prism, lambda. |
| 429 | Rate limited: too many requests. | Back off and retry with exponential backoff. Check the Retry-After header if present. |
| 500 | Internal server error. | Retry after a brief pause. If persistent, contact support. |
| 503 | Service unavailable: the API is temporarily overloaded or in maintenance. | Retry with backoff. Check the changelog for scheduled maintenance. |
Content type
All requests must use Content-Type: application/json with UTF-8 encoding. Responses are application/json for non-streaming requests and text/event-stream for streaming requests.
Related pages
Developer overview · Models · API pricing · Quickstart · Changelog