Chat Completions
Send OpenAI-compatible requests to /v1/chat/completions with Redline model aliases.
POST /v1/chat/completions
Endpoint: https://api.redline-api.duckdns.org/v1/chat/completions. Use an offered model alias and an array of role/content messages. Set an explicit output limit; your account tier also imposes a server-side limit.
curl
curl "https://api.redline-api.duckdns.org/v1/chat/completions" \
-H "Authorization: Bearer $REDLINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "redline-core",
"messages": [{
"role": "user",
"content": "Draft a checklist for an authorised code review."
}],
"max_tokens": 256
}' Request fields
model: an allowed model alias, such asredline-core.messages: the conversation, including the user prompt and any relevant context.max_tokens: the requested maximum output. Larger values remain subject to the tier limit.stream: set to true for server-sent events.stream_options.include_usage: request usage in streaming responses. Availability and fallback billing depend on the verified gateway behaviour.
Read a stream
Use an SDK to assemble streamed deltas. A disconnect is not a refund: generated work may already have incurred a charge. Avoid blindly retrying after a partial response, because a retry is a new request.
Python
from openai import OpenAI
import os
client = OpenAI(api_key=os.environ["REDLINE_API_KEY"], base_url="https://api.redline-api.duckdns.org/v1")
stream = client.chat.completions.create(
model="redline-core",
messages=[{"role": "user", "content": "List safe code review checks."}],
max_tokens=256,
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True) Compatibility scope
OpenAI-compatible describes the request format, not complete support for every OpenAI endpoint or feature. Responses API support is still being verified. Tool use, cancellation and streaming billing must pass launch verification.