Chat Completions
Generate model responses for a conversation. Drop-in compatible with OpenAI's Chat Completions API.
Endpoint
POST https://www.linguachats.ai//v1/chat/completionsRequest body
{
"model": "lyra",
"messages": [
{"role": "user", "content": "Write a short story opening."}
],
"stream": false,
"max_tokens": 1024,
"temperature": 0.8
}model (required) — a LinguaChats model slug, e.g. lyra, zenith, sage. See the Models page for the full catalog.
messages (required) — the conversation so far, as system, user, and assistant messages. Each LinguaChats model applies its own specialized system prompt before your messages; any system message you send is appended after ours as additional guidance.
stream (optional) — set true to receive server-sent events.
max_tokens (optional) — capped at 8192 per request.
Also supported: temperature, top_p, stop, frequency_penalty, presence_penalty.
Response
{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1720000000,
"model": "lyra",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The lighthouse keeper found the letter on a Tuesday..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 42,
"completion_tokens": 118,
"total_tokens": 160
}
}Streaming
With stream: true, the response is a standard OpenAI-style SSE stream of chat.completion.chunk events, terminated by data: [DONE]. Any OpenAI SDK handles this out of the box:
from openai import OpenAI
client = OpenAI(base_url="https://www.linguachats.ai//v1", api_key="YOUR_API_KEY")
stream = client.chat.completions.create(
model="lyra",
messages=[{"role": "user", "content": "Tell me a story."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")List models
GET https://www.linguachats.ai//v1/models returns the available model slugs in OpenAI list format.