base_url to the SnapGen OpenAI-compatible endpoint.
stream=True and iterate over the returned events.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use SnapGen with the official OpenAI Python SDK.
pip install openai
base_url to the SnapGen OpenAI-compatible endpoint.
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxx",
base_url="https://api.snapgen.org/v1",
)
response = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[
{"role": "user", "content": "Give me one API reliability tip."}
],
)
print(response.choices[0].message.content)
stream=True and iterate over the returned events.
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxx",
base_url="https://api.snapgen.org/v1",
)
stream = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[{"role": "user", "content": "Say hello in three words."}],
stream=True,
)
for event in stream:
content = event.choices[0].delta.content
if content:
print(content, end="")