Skip to main content
The Pro and Enterprise tiers ship with a unified LLM layer that lets you talk to multiple AI providers through a single set of endpoints. You can send multi-turn chat messages, stream token-by-token responses via Server-Sent Events, or generate one-shot text completions — all with the same request shape. Switching providers is a single field change in your request body. All AI endpoints live under /api/ai and are protected by authentication and rate limiting.
The AI and LLM features require the Pro or Enterprise tier. Requests from Basic tier accounts will be rejected with 403 Forbidden.

Sending a chat message

Send a POST request to /api/ai/chat with a messages array following the OpenAI-style role format. Choose your provider, model, and generation parameters. Set stream: false (the default) to receive the full response at once.
Request
Response — 200 OK
The full ChatRequest schema:

Streaming responses

Set stream: true in your request to receive a text/event-stream response. Each event carries a single token. The stream ends with a [DONE] sentinel.
Streaming request
Each chunk arrives as a Server-Sent Event:
Consume the stream in JavaScript using EventSource or the fetch API with a ReadableStream:
Consuming SSE in JavaScript

Text completions

For single-turn generation from a plain-text prompt, use POST /api/ai/completions. You can optionally provide a system_prompt to set context.
Request
Response — 200 OK

Supported providers

Set the provider field in any request to switch between backends. The model name must be valid for the chosen provider.
Requires OPENAI_API_KEY in your environment. Supported models include gpt-4o, gpt-4o-mini, gpt-4-turbo, and gpt-3.5-turbo.