SacredAI and Heretic through a familiar OpenAI-compatible API.
Connect SacredAI or sacredai-heretic through the familiar OpenAI format. Only the Base URL and key change.
01 — Documentation without the wall of text
Your first request in minutes
https://sacredgpt.pro/v101Quick startKey, environment variable, and first cURL
- Review plansThe Chat plan sets 5h / 7d windows. These are quota units, not a token price.
- Start with the free windowsFree SacredAI: 10,000 / 5h and 50,000 / 7d. Heretic has 10 lifetime requests. An ordinary key shares those windows with chat and browser Agent. Hosted Hermes is a separate subscription with its own quota; no Chat plan is required for it.
- Enable 2FAKey creation is protected by a one-time code.
- Choose a plan if the windows are not enoughA paid Chat plan gives each model its own windows. There are no one-off balance top-ups.
- Create and store the key
SACREDGPT_KEY=sg_live_… - Send the cURL requestUse a stable model ID.
curl https://sacredgpt.pro/v1/chat/completions \
-H "Authorization: Bearer $SACREDGPT_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sacredai-heretic",
"messages": [{"role": "user", "content": "Hello!"}]
}'02OpenAI SDK and model listPython · TypeScript · GET /v1/models
Official OpenAI SDKs work without an adapter. Set the SacredGPT Base URL and your key; GET /v1/models returns the stable IDs available to it.
from openai import OpenAI
client = OpenAI(
base_url="https://sacredgpt.pro/v1",
api_key="sg_live_...",
)
response = client.chat.completions.create(
model="sacredai-heretic",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://sacredgpt.pro/v1",
apiKey: process.env.SACREDGPT_KEY,
});
const response = await client.chat.completions.create({
model: "sacredai-heretic",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);GET /v1/models — models available to the current key and their context windows.
| Model name | Model ID |
|---|---|
| SacredAI | sacredgpt-auto |
| SacredAI Heretic | sacredai-heretic |
03StreamingIncremental responses over Server-Sent Events
Add stream: true. The SDK returns an async stream of response deltas.
const stream = await client.chat.completions.create({
model: "sacredai-heretic",
messages: [{ role: "user", content: "Explain this code" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}04Tools & Structured OutputFunction calls and JSON Schema responses
- Pass tools and tool_choice in the OpenAI format; requested function calls are returned in tool_calls.
- Use response_format for structured responses. Availability depends on the current Heretic route.
- SacredGPT does not execute functions for you: your code handles tool_calls and sends the result back to the model.
05API privacyRetention follows the current Heretic route
API request content is not added to chat history; only technical data required for billing, limits, and security is retained. Heretic requests follow the current provider's retention terms.
06Quotas and limitsAccount windows, key budgets, RPM, and TPM
- Ordinary Public API shares a model's windows with chat: free SacredAI and 10 lifetime Heretic requests, then the active paid plan's windows. There is no per-token rouble price.
- When the limit is exhausted, access returns as the 5-hour or 7-day window recovers. A paid Chat plan gives higher limits.
- The current UI exposes daily and monthly budgets. RPM, TPM, and concurrent streams are enforced by the server; advanced configuration is not yet available in the dashboard.
- GET /v1/usage with the usage:read scope returns usage for that API key plus a separately labeled account-shared Heretic status. Managed Hermes keys do not receive the owner's shared status.
- For sacredai-heretic, an exact final user command of /usage or heretic usage in Chat Completions returns shared status without a model call, quota usage, or charge. A client may intercept a same-named local command before HTTP, which the server cannot override; use GET /v1/usage as the reliable fallback.
GET /v1/usage · x-ratelimit-limit-* · x-ratelimit-remaining-* · x-ratelimit-reset-*
07ErrorsCodes your application should handle
| HTTP | Code | What happened |
|---|---|---|
| 400 | invalid_request | Invalid request body or parameters |
| 401 | invalid_api_key | The key is invalid, expired, or lacks the required scope |
| 402 | insufficient_balance | No active quota, or the model window is exhausted |
| 429 | rate_limit_exceeded | RPM, TPM, or concurrent stream limit exceeded |
| 502 | provider_error | Temporary model provider failure |
| 503 | model_unavailable | No suitable route is currently available for the model |
Found a bug? Show us.
Tell us what happened and what you expected. The page address and browser details help us reproduce it faster.
