Faelith
ContactDownload
Chat Completions

API

Chat Completions

POST /v1/chat/completions: request body, streaming, tools and images.

The gateway speaks the OpenAI chat-completions protocol, so most SDKs work by changing the base URL to https://api.faelithindustries.com/v1.

bash
curl https://api.faelithindustries.com/v1/chat/completions \
  -H "Authorization: Bearer $FAELITH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "echo",
    "messages": [{"role": "user", "content": "Summarize this repo layout."}],
    "stream": true
  }'

Request#

FieldTypeNotes
modelstringecho, horizon
messagesarraysystem, user, assistant, tool roles; content may be a string or an array of text / image_url parts
streambooleanServer-sent events with data: frames ending in [DONE]
tools / tool_choicearray / stringOpenAI function-calling shape
reasoning_effortstringThinking level; see Echo and Horizon
max_tokens, temperature, top_p, stop—Standard sampling controls

Response#

Non-streaming responses return a chat.completion object with choices[0].message and a usage block:

json
{
  "usage": {
    "prompt_tokens": 1231,
    "completion_tokens": 212,
    "prompt_tokens_details": { "cached_tokens": 1024 }
  }
}

Cached prompt tokens are billed at the cache-read rate. Streaming responses emit chat.completion.chunk objects; reasoning arrives in delta.reasoning_content before delta.content.

SDK example#

python
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.faelithindustries.com/v1", api_key=os.environ["FAELITH_API_KEY"])
stream = client.chat.completions.create(
    model="horizon",
    messages=[{"role": "user", "content": "Find the race in this scheduler."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Limits#

  • Request bodies are capped by the gateway (413 when exceeded); keep base64 images small and prefer several turns over one giant prompt.
  • Budgets, not rate limits, are the usual reason a request fails: a 402 means a meter or the wallet is exhausted. See Errors.

Found a mistake or a gap? Tell us and we will fix the page.