API reference

The GLAVYN AI API is compatible with the OpenAI Chat Completions API. Base URL: https://ai.glavyn.scify-tech.com/v1

Authentication

Create a key in Dashboard → API keys and send it as a bearer token. Keep keys server-side; never embed them in browser or mobile apps.

Authorization: Bearer gl_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Quickstart

curl
curl https://ai.glavyn.scify-tech.com/v1/chat/completions \
  -H "Authorization: Bearer $GLAVYN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "glavyn-2.5", "messages": [{"role": "user", "content": "Hello"}]}'
Python (openai SDK)
from openai import OpenAI

client = OpenAI(base_url="https://ai.glavyn.scify-tech.com/v1", api_key="gl_live_...")
resp = client.chat.completions.create(
    model="glavyn-2.5",
    messages=[{"role": "user", "content": "Write a haiku about compilers"}],
)
print(resp.choices[0].message.content)
Node.js (openai SDK)
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://ai.glavyn.scify-tech.com/v1", apiKey: process.env.GLAVYN_API_KEY });
const stream = await client.chat.completions.create({
  model: "glavyn-2.5",
  messages: [{ role: "user", content: "Explain SSE in one paragraph" }],
  stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");

POST /v1/chat/completions

FieldTypeDescription
modelstringModel id (a GLAVYN AI version), e.g. glavyn-2.5, or glavyn-2.8 for 2.8 Premium. Must be enabled for your plan; GET /v1/models lists yours.
messagesarrayConversation so far. Roles: system, developer, user, assistant. User content may include text parts and base64 data-URL images (image_url) or PDFs (file.file_data).
streambooleanStream tokens as Server-Sent Events. Default false.
stream_options.include_usagebooleanSend a final chunk with token usage when streaming.
max_tokens / max_completion_tokensintegerMaximum output tokens (includes reasoning tokens). Capped by the model and your plan.
temperaturenumber0–2. Ignored by models that do not support sampling controls.
top_pnumber0–1.
stopstring | string[]Up to 4 stop sequences.
response_formatobject{"type":"json_object"} or {"type":"json_schema","json_schema":{"schema":{...}}}.
reasoning_effortstringnone | minimal | low | medium | high. How much the model thinks before answering (reasoning-capable models); more thinking means slower first tokens.
userstringOptional end-user identifier for your own tracking.

Not supported yet: tools / function calling, n > 1, remote image URLs, audio input in chat messages (use /v1/audio/transcriptions). These return HTTP 400 with a clear message.

Response
{
  "id": "chatcmpl-8Hk2...",
  "object": "chat.completion",
  "created": 1793500000,
  "model": "glavyn-2.5",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "Hello! How can I help?" },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21,
    "prompt_tokens_details": { "cached_tokens": 0 },
    "completion_tokens_details": { "reasoning_tokens": 0 }
  }
}

Every response carries an x-request-id header. Quote it when contacting support.

Streaming

With "stream": true the response is text/event-stream. Each event is a chat.completion.chunk; the stream ends with data: [DONE]. Lines beginning with : are keep-alive comments. If an error occurs after streaming has started, an event with an error object is sent before [DONE]. Closing the connection stops generation; you are billed for the tokens generated up to that point.

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hel"},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":12,"completion_tokens":9,"total_tokens":21}}

data: [DONE]

Speech and transcription

POST /v1/audio/speech turns text into speech and returns a WAV file (24 kHz, 16-bit, mono). POST /v1/audio/transcriptions turns a recording into text. Both follow the OpenAI audio API, so the OpenAI SDKs work with the base URL above. They are billed per token like chat: speech by input text and output audio tokens (about 25 per second), transcription by input audio tokens (about 32 per second) and output text.

FieldTypeDescription
modelstringglavyn-voice (speech) or glavyn-transcribe (transcription). Omit it, or send an OpenAI name such as tts-1 or whisper-1, to use the default model of your plan.
inputstringSpeech: the text to read, up to 4,096 characters.
voicestringSpeech: one of 30 voices (Kore, Puck, Zephyr, Charon, Aoede, …) or an OpenAI voice name (alloy, echo, nova, …). Default Kore.
response_formatstringSpeech: wav (default) or pcm. Transcription: json (default) or text.
filefileTranscription (multipart/form-data): wav, mp3, m4a, aac, ogg, opus, flac, aiff or webm, up to 14 MB.
languagestringTranscription: optional BCP-47 code such as en-US or hi-IN; omitted = detected automatically.
promptstringTranscription: optional names or terms to spell correctly.
curl
curl https://ai.glavyn.scify-tech.com/v1/audio/speech -H "Authorization: Bearer $GLAVYN_API_KEY" \
  -H "Content-Type: application/json" -d '{"input": "Hello from GLAVYN AI", "voice": "Kore"}' -o hello.wav

curl https://ai.glavyn.scify-tech.com/v1/audio/transcriptions -H "Authorization: Bearer $GLAVYN_API_KEY" \
  -F file=@meeting.mp3 -F model=glavyn-transcribe
Python (openai SDK)
speech = client.audio.speech.create(model="glavyn-voice", voice="Kore", input="Hello", response_format="wav")
speech.write_to_file("hello.wav")

with open("meeting.mp3", "rb") as f:
    print(client.audio.transcriptions.create(model="glavyn-transcribe", file=f).text)

GET /v1/models

Lists the models enabled for your account, with context window, output limit, and per-million-token prices. Each entry has a type: chat, speech or transcription. GET /v1/models/{id} returns one model.

  • GLAVYN Ultra

    The most capable model, for complex questions, coding, analysis, images and PDFs.

    glavyn-2.8
    Input / 1M (Price per million input tokens)
    $2.00
    Output / 1M (Price per million output tokens)
    $10.00
    Context window
    1M tokens
    Max output
    65.5K tokens
  • GLAVYN Core

    Fast, balanced model for everyday chat, writing, coding help and documents.

    glavyn-2.5
    Input / 1M (Price per million input tokens)
    $0.50
    Output / 1M (Price per million output tokens)
    $3.00
    Context window
    1M tokens
    Max output
    65.5K tokens
  • GLAVYN Flash

    Lightweight model for quick questions, summaries and short drafts.

    glavyn-2.0
    Input / 1M (Price per million input tokens)
    $0.20
    Output / 1M (Price per million output tokens)
    $0.80
    Context window
    262.1K tokens
    Max output
    8,192 tokens

GET /v1/usage

Token usage and cost. Defaults to the current billing period. Query parameters: start_date and end_date (YYYY-MM-DD), and scope=key to report only the calling key.

curl "https://ai.glavyn.scify-tech.com/v1/usage?start_date=2026-11-01&end_date=2026-11-30" -H "Authorization: Bearer $GLAVYN_API_KEY"
Response (abridged)
{
  "object": "usage",
  "period": { "start": "2026-11-01T00:00:00.000Z", "end": "2026-11-30T23:59:59.999Z" },
  "totals": { "requests": 42, "input_tokens": 51200, "output_tokens": 18300, "cost_usd": 0.285 },
  "by_model": [{ "model": "glavyn-2.5", "requests": 40, "cost_usd": 0.27 }],
  "daily": [{ "date": "2026-11-01", "requests": 12, "cost_usd": 0.08 }],
  "credits": { "balance_usd": 9.71 }
}

API keys

FieldTypeDescription
GET /v1/keys—List your keys (prefix, last four characters, status, last use). Full keys are never returned.
POST /v1/keys{ name, expires_at?, rpm_limit? }Create a key. The response contains the full key once.
DELETE /v1/keys/{id}—Revoke a key immediately.

Errors

Errors use the OpenAI shape: {"error": {"message", "type", "param", "code"}}.

FieldTypeDescription
400invalid_request_errorMalformed request, unsupported parameter, or context_length_exceeded.
401authentication_errorMissing, invalid, expired, or revoked API key.
402insufficient_quotaYour credit balance cannot cover the request (insufficient_credits).
404not_found_errorUnknown model or one not enabled for your plan (model_not_found).
413invalid_request_errorRequest body too large (25 MB; 15 MB of inline media).
429rate_limit_errorRate limit, daily or monthly limit, or capacity exhausted. Honour the Retry-After header.
503api_errorThe model is temporarily unavailable. Retry with exponential backoff.
504api_errorThe model did not respond in time.

Rate limits

Limits depend on your plan (requests per minute, optional daily requests and monthly tokens) and can also be set per API key. When a limit is reached the API returns HTTP 429 with a Retry-After header in seconds. Retry with exponential backoff and jitter.