API reference
The public API surface — bearer auth, GET /v1/models discovery, POST /v1/chat/completions fields, streaming, tools, and error semantics.
This page documents the supported inference endpoints for the current build environment. The routes below are the inference surface; there is no Responses API, no Anthropic Messages API, and no embeddings endpoint on this base URL, so do not point SDK features at it that assume them.
Authentication
Every request carries your key as an HTTP bearer credential:
Authorization: Bearer $TERALOR_API_KEY(inject the variable from your secret manager — never a literal key). Requests with a missing or
malformed Authorization header, or an unknown key, are rejected before any model work happens. A
recognized key that is revoked, expired, or whose account/entitlement state refuses admission gets a
403 instead — Troubleshooting explains how to tell the two apart. The key
is a secret — never in URLs, source control, browser code, or support messages.
GET /v1/models
Discovery. Requires auth and an empty body (a GET with a body is a 400). Returns the effective
catalog — the intersection of the configured models and the currently healthy live capability subset,
in canonical order — as an OpenAI-style list. Each entry carries at least:
| Field | Meaning |
|---|---|
id | The model id to send in requests (canonical: Flash). |
object, owned_by | Standard OpenAI-style list metadata. |
context_length | Total context window (C in the budgeting math). |
max_input_tokens | Input ceiling (I). |
max_output_tokens | Output ceiling (Omax); the default max_tokens when you omit it. |
capabilities | What the model accepts now, e.g. tools and reasoning (effort list, defaults, disable value). |
policy_revision | The policy version your discovery response was served under. |
Read the values from your response — this page deliberately does not print sample numbers, because any static numbers here could be mistaken for current limits. Treat discovery as authoritative for limits, capabilities, and the policy revision you are being served under. If a model is configured but its provider is unhealthy, it is simply absent from this list. Note also that discovery success reflects the state at that moment; a later completion can still be refused by budget, rate limiting, or runtime state.
POST /v1/chat/completions
Chat Completions for the Flash model. The Content-Type media type must be application/json
(a charset parameter, e.g. application/json; charset=utf-8, is accepted); the body must be a JSON
object, and the body size is bounded (oversized requests are rejected before parsing).
Allowed fields — every other top-level field is rejected with a 400:
| Field | Type | Notes |
|---|---|---|
model | string | The model id from discovery (use Flash). |
messages | array | Standard chat message roles; sequences must be well-formed. |
stream | boolean | true requests incremental SSE-style chunk delivery of the completion. |
stream_options | object | Passed through with stream. |
max_tokens | integer | 1..max_output_tokens from discovery; defaults to the advertised output ceiling when omitted. Your reservation must also leave input room — see Use Flash well. |
reasoning_effort | string | Only values advertised in capabilities.reasoning.efforts (or the disable value). |
think | boolean | Disable knob mirroring reasoning disable support; paired with the disable reasoning_effort value. |
tools | array | Only when discovery advertises capabilities.tools: true. |
tool_choice | string/object | Same capability gate as tools. |
Example (non-streaming):
curl -s https://api.teralor.com/v1/chat/completions \
-H "Authorization: Bearer $TERALOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Flash",
"messages": [{"role": "user", "content": "Summarize this changelog in two bullets."}],
"max_tokens": 512,
"stream": false
}'Responses are standard OpenAI-style chat completions (an id, choices, usage when available). With
"stream": true the same route streams chunks instead; intermediate transport errors simply end the
stream — see Troubleshooting for the replay rules.
Tools. When tools is advertised and supplied, the assistant may return tool-call requests in its
message. Your harness executes them under its own authority and sends role: "tool" results back in a
follow-up request. The model never executes anything itself.
Context admission. Rendered input plus reserved max_tokens must fit the advertised
context_length, and input must respect max_input_tokens; violations are 400s before dispatch — see
Use Flash well for the budgeting math.
Errors
The API returns JSON errors in the shape {"error": {"message", "type", "param", "code"}} with an
HTTP status matching the category. type is invalid_request_error for 4xx and api_error for 5xx.
Rate/concurrency headers (retry-after, x-ratelimit-*) are forwarded when the platform supplies
them. Edge infrastructure (a proxy or load balancer) can occasionally return its own HTML error page
instead — treat non-JSON error bodies as an infrastructure signal, not an API response. The status
narrows the category; the response message plus your account state identify the exact cause.
| Status | Meaning |
|---|---|
400 | Malformed or disallowed request: bad JSON, non-object body, unsupported fields, unknown model id, out-of-range max_tokens, max_tokens leaving no input room, disallowed reasoning_effort/think, tools without advertised capability, GET with body. |
401 | Missing or malformed bearer header, or an unknown key. |
403 | A recognized key that cannot authorize: revoked or expired key, inactive account, reconciliation hold, or unsynchronized entitlement. |
404 | A route other than the two documented ones. |
413 | Request body exceeds the configured byte limit. |
415 | Content-Type media type is not application/json. |
429 | Rate/concurrency rejection; honor retry-after when present. |
502 | Upstream (provider) failure or an internal fault — not your request's shape. Dispatch may be uncertain; see the retry rules in Troubleshooting. |
503 | The model is configured but currently unhealthy/unavailable. |
For what to do about each of these, see Troubleshooting.