-
Notifications
You must be signed in to change notification settings - Fork 0
OpenAI Compatible API
A workflow can be served as an OpenAI-compatible model. Any client or SDK that speaks the OpenAI chat API can point at it with a base-URL change — no new integration, no bespoke client.
Per workflow:
POST /api/streaming/workflows/{workflow_id}/v1/chat/completions
GET /api/streaming/workflows/{workflow_id}/v1/models
POST /api/streaming/workflows/{workflow_id}/v1/responses
And per live session:
POST /api/streaming/sessions/{session_key}/v1/chat/completions
GET /api/streaming/sessions/{session_key}/v1/models
POST /api/streaming/sessions/{session_key}/v1/responses
Open the workflow → Settings → OpenAI-compatible model → on.
You can then set:
| Setting | What it does |
|---|---|
| Default handler | Which handler each chat message invokes. |
| Response field | Which field of the handler's result becomes the reply. |
| Model name | The id returned by /v1/models. |
| Description, Version | Model card metadata. |
| Capabilities | Vision, tool calling, streaming, file upload. |
| Limits | Context window, max output tokens. |
from openai import OpenAI
client = OpenAI(
base_url="https://writ.example.com/api/streaming/workflows/12/v1",
api_key="wt_...",
)
resp = client.chat.completions.create(
model="streaming",
messages=[{"role": "user", "content": "What is the current price?"}],
)The API key is an ordinary Writ key — see scopes.
It suits workflows that are conversational or multi-turn, where a caller wants to keep asking against a live browser session rather than fire one shot and stop. For a plain "run it and give me the data" integration, the REST endpoint is simpler.
Streaming lists live sessions with their handlers and events. A session holds a browser open across calls, so state persists between messages. Session lifetime, concurrency and persistence are configured in the same Settings tab.
usewrit/writ · AGPL-3.0-only · Issues · Discussions · Report a vulnerability
Getting started
Using it
Integrations
Operations
Reference