API Reference

Hush AI API Documentation

OpenAI-compatible chat completions API. Your data never leaves hardware we own.

All API requests are processed in memory on hardware we own. Nothing is stored, nothing is logged, nothing is trained on. This applies to every endpoint and every model.

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

ParameterTypeDescription
modelstringRequiredModel ID to use: omega, prism, or lambda.
messagesarrayRequiredArray of message objects. Each has role (system, user, or assistant) and content (string).
temperaturenumberOptionalSampling temperature, 0 to 2. Higher values make output more random. Default: 1.
max_tokensintegerOptionalMaximum number of tokens to generate in the response.
top_pnumberOptionalNucleus sampling. Consider tokens with top_p probability mass. Default: 1.
streambooleanOptionalIf true, partial message deltas are sent as server-sent events. Default: false.
stopstring or arrayOptionalUp to 4 sequences where the API will stop generating.
frequency_penaltynumberOptionalPenalise tokens based on frequency in the text so far, −2.0 to 2.0. Default: 0.
presence_penaltynumberOptionalPenalise 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

FieldTypeDescription
idstringUnique identifier for this completion.
objectstringAlways chat.completion.
createdintegerUnix timestamp of when the completion was created.
modelstringThe model used for this completion.
choicesarrayArray of completion choices. Each contains index, message (with role and content), and finish_reason.
usageobjectToken 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"
  }
}
CodeMeaningWhat to do
400Bad request: malformed JSON or missing required fields.Check your request body. Ensure model and messages are present and correctly formatted.
401Unauthorised: missing or invalid API key.Check the Authorization header. Ensure the key starts with the correct prefix and has not been revoked.
403Forbidden: the key does not have permission for this resource.Contact support.
404Not found: the endpoint or model does not exist.Check the URL and model ID. Valid models: omega, prism, lambda.
429Rate limited: too many requests.Back off and retry with exponential backoff. Check the Retry-After header if present.
500Internal server error.Retry after a brief pause. If persistent, contact support.
503Service 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.