Overview
Parallel AI’s chat completions endpoint is a drop-in replacement for the OpenAI Chat Completions API. If you already use the OpenAI SDK or any OpenAI-compatible library, you can switch to Parallel AI by changing only two things: the base URL and the API key. Your existing code requires no other modifications. Endpoint:POST https://api.parallellabs.app/api/v0/chat/completions
This endpoint follows the OpenAI Chat Completions specification. Any tool, library, or framework built for the OpenAI API will work seamlessly with Parallel AI.
Request Parameters
Each message in
messages must have:
role: one ofsystem,user,assistant, ortoolcontent: the message text (or an array of content parts for multimodal inputs)
Quickstart Examples
Using the OpenAI Python SDK
Point the OpenAI client at Parallel AI’s base URL — no other changes needed.Using cURL
Streaming
Whenstream is set to true, the API returns a stream of Server-Sent Events (SSE). Each event contains a JSON delta with the incremental content. The stream ends with a final data: [DONE] message.
Streaming is useful for:
- Displaying responses word-by-word in a UI for a faster perceived response time
- Long-form generation where you want to process output incrementally
- Reducing time-to-first-token in latency-sensitive applications
Response Format
A standard (non-streaming) response looks like this:Token Usage
Theusage object in every response reports:
Monitor
total_tokens to track and optimize your API usage costs.
Using the OpenAI Node.js SDK
Next Steps
Chat Completions API Reference
View the full request schema, response types, and error codes.
OpenAI Compatibility Guide
Learn exactly which OpenAI features are supported and how to migrate existing projects.
