Skip to main content

OpenAI-Compatible API

ChatWalaʻau exposes the agent as an OpenAI-compatible endpoint so any app using the OpenAI SDK can consume it.

API_KEY=sk-chatwalaau-your-secret-key-here

Point the SDK's base_url at your instance:

from openai import OpenAI

client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="sk-chatwalaau-your-secret-key-here",
)

# Non-streaming
response = client.responses.create(
model="chatwalaau",
input="What is the weather in Tokyo?",
)

# Streaming
stream = client.responses.create(
model="chatwalaau",
input="Explain quantum computing.",
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
  • All agent Tools (Weather, Coding, Image Generation) and Skills are available
  • Multi-turn conversations via previous_response_id
  • API sessions appear in the chat sidebar with an API badge
  • Streaming (SSE) and non-streaming modes

Structured output

The endpoint honors the standard OpenAI text.format field, so you can constrain the answer to JSON or to a specific JSON Schema with your existing SDK code. It is resolved through the same provider seam as the chat UI, so it works for both Azure OpenAI and Anthropic models.

# Constrain to a JSON Schema
response = client.responses.create(
model="chatwalaau",
input="Extract the city and the temperature unit from: weather in Tokyo in Celsius.",
text={
"format": {
"type": "json_schema",
"name": "extraction",
"schema": {
"type": "object",
"properties": {"city": {"type": "string"}, "unit": {"type": "string"}},
"required": ["city", "unit"],
"additionalProperties": False,
},
"strict": True,
}
},
)

# Or just ask for generic JSON
response = client.responses.create(
model="chatwalaau",
input="List three primary colors as JSON.",
text={"format": {"type": "json_object"}},
)

Omit text.format for normal prose output (the default). See Models & Reasoning -> Structured output for the chat-UI side.

/v1/responses always requires a matching Bearer key, regardless of client address, because it is designed for external apps -- see Authentication.