Hormouz API v1.0

API Documentation

Everything you need to integrate Hormouz into your product. Chat with LLMs, generate images, and browse the model catalogue — all through one API key.

OpenAI-compatible 350+ models Streaming (SSE) Credit-based billing

Connect in 30 seconds

Set these two values in your OpenAI SDK (or any HTTP client) and you're ready to go.

Base URL
https://api.hormouz.net/v1
Authorization Header
Bearer ng-YOUR_KEY

Your first request

Drop-in compatible with the OpenAI SDK. Point it at Hormouz and start building.

from openai import OpenAI

client = OpenAI(
    api_key="ng-YOUR_KEY",
    base_url="https://api.hormouz.net/v1",
)

resp = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
curl https://api.hormouz.net/v1/chat/completions \
  -H "Authorization: Bearer ng-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "ng-YOUR_KEY",
  baseURL: "https://api.hormouz.net/v1",
});

const resp = await client.chat.completions.create({
  model: "openai/gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

How it works

Understand the key building blocks before diving into the API reference.

Chat Completions

Send messages to any LLM and get a response. Supports streaming for real-time chat UIs, tool/function calling, vision (image inputs), and all OpenAI SDK features. Use POST /v1/chat/completions.

Image Generation

Generate images with FLUX, Stable Diffusion, and other models via an async prediction flow. Create a prediction, poll for completion, then download the mirrored output. Use POST /v1/predictions.

Model Catalogue

Browse 350+ models with pricing, capabilities, and the API shape to use. Check api_shape to know whether to call /v1/chat/completions or /v1/predictions. Use GET /v1/models.

Credit Billing

A hold is placed before each request. After completion, the actual cost is settled and the difference is released. If your balance is too low, the request returns 402. Check your balance in the dashboard.

Content Policy

You own what you send. Hormouz is a gateway — we don't moderate or approve your content. We offer an on-demand moderation API (POST /v1/moderations/image) with 3 classifier models at different price points ($0.001–$0.015 per call). You can also opt in to automatic pre-flight screening on image-only models (contact support to enable). See GET /v1/moderation-models for available classifiers and pricing.

Text Embeddings

Convert text into vector representations for search, clustering, and similarity. OpenAI-compatible — use your existing SDK with POST /v1/embeddings. Supports single strings and batch arrays. Cost is settled instantly from the upstream response.

Optimise for Cost or Speed

Many models can be served several ways, at very different prices and speeds. Add "sorted_by": "cheapest" | "latency" | "throughput" to a chat request and it is routed accordingly — cheapest per token, fastest first token, or highest tokens per second. Ranking follows live traffic, so it tracks current conditions and temporary discounts. It is a preference, not a guarantee: if the best option is busy, the next one serves it instead of failing. Note that a sorted request bills at the model's standard list price — any discounted route the model normally takes is skipped for that request. Any other value is rejected with 400 INVALID_SORTED_BY. Models where it applies are marked supports_sorted_by in GET /v1/models.

Error codes

All errors return a JSON envelope with code, message, and status. Match the code field in your error handling.

Status Code Meaning
400BAD_REQUESTInvalid request body or parameters
401UNAUTHORIZEDMissing or invalid API key
402INSUFFICIENT_CREDITSNot enough credit balance
404NOT_FOUNDResource not found or not owned by you
409CONFLICTIdempotency key conflict
429RATE_LIMITEDToo many requests, slow down
451CONTENT_POLICY_VIOLATIONImage flagged by content policy (NSFW/explicit)
503UPSTREAM_ERRORProvider temporarily unavailable, retry with backoff

API Reference

Explore every endpoint, try requests live, and inspect response schemas. Click "Authorize" to enter your API key first.