API v1 Reference

Familiar API. World-Class Models.

SacredGPT supports the familiar OpenAI Models and Chat Completions endpoints. Official Python and TypeScript SDKs work after overriding the Base URL and API key.

Base URL: https://api.sacredgpt.ru/v1Bearer SACREDGPT_KEYOpenAI SDK Ready

1. Authentication

All API requests require an Authorization header with a Bearer token. You can create API keys in your dashboard after securing your account with 2FA (TOTP).

Authorization: Bearer sg_live_9a8b7c6d5e4f3a2b1c0d

2. List Models (GET /v1/models)

Returns a list of all active curated models along with their stable IDs, capabilities, and context limits.

curl https://api.sacredgpt.ru/v1/models \
  -H "Authorization: Bearer $SACREDGPT_KEY"

3. Chat Completions (POST /v1/chat/completions)

Main generation endpoint. Accepts a message history array, target model identifier, and configuration parameters.

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://api.sacredgpt.ru/v1",
    api_key="sgpt_live_..."
)

response = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=[
        {"role": "system", "content": "You are an expert software architect."},
        {"role": "user", "content": "Explain microservices transaction rollback patterns."}
    ]
)

print(response.choices[0].message.content)

TypeScript (OpenAI Node SDK)

import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://api.sacredgpt.ru/v1',
  apiKey: process.env.SACREDGPT_KEY,
});

const completion = await openai.chat.completions.create({
  model: 'claude-sonnet-5',
  messages: [{ role: 'user', content: 'Write a TypeScript generic utility type.' }],
});

console.log(completion.choices[0].message.content);

4. Streaming Responses (SSE)

Pass stream: true to receive response chunks via Server-Sent Events (SSE) as they are generated.

const stream = await openai.chat.completions.create({
  model: 'deepseek-v4-pro',
  messages: [{ role: 'user', content: 'Stream prime numbers up to 100.' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

5. Tools & Function Calling

Supports standard OpenAI tools parameter formatting with JSON Schema for agentic function invocation.

6. Privacy-First Routing

API requests deny data collection and use Zero Data Retention-capable routes by default. No extra privacy header is required. If the selected model has no eligible route, the API returns model_unavailable.

curl https://api.sacredgpt.ru/v1/chat/completions \
  -H "Authorization: Bearer $SACREDGPT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-terra","messages":[{"role":"user","content":"Sensitive calculation"}]}'

7. Credits and Charges

1 credit equals ₽1. SacredGPT reserves the estimated maximum before a request, settles the actual input/output token cost after completion, and releases the remainder. The API uses a separate topped-up balance; chat subscription credits are not used.

8. RPM, TPM, and Stream Limits

Each key has its own requests/minute, tokens/minute, concurrent-stream, and optional daily/monthly budget limits. Current values are returned in x-ratelimit-limit-*, x-ratelimit-remaining-*, and x-ratelimit-reset-* headers.

9. API Error Reference

Status CodeError CodeDescription
401invalid_api_keyInvalid, expired, or insufficiently scoped API key
402insufficient_balanceInsufficient funds in the API wallet
429rate_limit_exceededRPM, TPM, or concurrent stream limit exceeded
502provider_errorUpstream model provider returned an error
503model_unavailableNo privacy-safe route is available for the model