Bring real-time web research to interactive AI applications
The Parallel Chat API is a low latency web research API that returns OpenAI ChatCompletions compatible streaming text and JSON. The Chat API is designed for interactive workflows where speed is paramount.
Beta Notice: The Parallel Chat API is in beta. We provide a rate limit of 30 requests per minute for the Chat API out of the box. Contact us for production capacity.
For the best experience and access to Parallel’s best processors, we recommend using the Parallel Task API.
from openai import OpenAIclient = OpenAI( api_key="PARALLEL_API_KEY", # Your Parallel API key base_url="https://beta.parallel.ai" # Parallel's API beta endpoint)response = client.chat.completions.create( model="speed", # Parallel model name messages=[ {"role": "user", "content": "What does Parallel Web Systems do?"} ], response_format={ "type": "json_schema", "json_schema": { "name": "reasoning_schema", "schema": { "type": "object", "properties": { "reasoning": { "type": "string", "description": "Think step by step to arrive at the answer", }, "answer": { "type": "string", "description": "The direct answer to the question", }, "citations": { "type": "array", "items": {"type": "string"}, "description": "Sources cited to support the answer", }, }, }, }, },)print(response.choices[0].message.content)
Copy
from openai import OpenAIclient = OpenAI( api_key="PARALLEL_API_KEY", # Your Parallel API key base_url="https://beta.parallel.ai" # Parallel's API beta endpoint)response = client.chat.completions.create( model="speed", # Parallel model name messages=[ {"role": "user", "content": "What does Parallel Web Systems do?"} ], response_format={ "type": "json_schema", "json_schema": { "name": "reasoning_schema", "schema": { "type": "object", "properties": { "reasoning": { "type": "string", "description": "Think step by step to arrive at the answer", }, "answer": { "type": "string", "description": "The direct answer to the question", }, "citations": { "type": "array", "items": {"type": "string"}, "description": "Sources cited to support the answer", }, }, }, }, },)print(response.choices[0].message.content)
Copy
from openai import OpenAIclient = OpenAI( api_key="PARALLEL_API_KEY", # Your Parallel API key base_url="https://beta.parallel.ai" # Parallel's API beta endpoint)stream = client.chat.completions.create( model="speed", # Parallel model name messages=[ {"role": "user", "content": "What does Parallel Web Systems do?"} ], stream=True, response_format={ "type": "json_schema", "json_schema": { "name": "reasoning_schema", "schema": { "type": "object", "properties": { "reasoning": { "type": "string", "description": "Think step by step to arrive at the answer", }, "answer": { "type": "string", "description": "The direct answer to the question", }, "citations": { "type": "array", "items": {"type": "string"}, "description": "Sources cited to support the answer", }, }, }, }, },)for chunk in stream: if chunk.choices[0].delta.content is not None: print(chunk.choices[0].delta.content, end="", flush=True)print()
Copy
import OpenAI from 'openai';const client = new OpenAI({ apiKey: 'PARALLEL_API_KEY', // Your Parallel API key baseURL: 'https://beta.parallel.ai', // Parallel's API beta endpoint});async function main() { const response = await client.chat.completions.create({ model: 'speed', // Parallel model name messages: [ { role: 'user', content: 'What does Parallel Web Systems do?' } ], response_format: { type: 'json_schema', json_schema: { name: 'reasoning_schema', schema: { type: 'object', properties: { reasoning: { type: 'string', description: 'Think step by step to arrive at the answer', }, answer: { type: 'string', description: 'The direct answer to the question', }, citations: { type: 'array', items: { type: 'string' }, description: 'Sources cited to support the answer', }, }, }, }, }, }); console.log(response.choices[0].message.content);}main();
Copy
import OpenAI from 'openai';const client = new OpenAI({ apiKey: 'PARALLEL_API_KEY', // Your Parallel API key baseURL: 'https://beta.parallel.ai', // Parallel's API beta endpoint});async function main() { const stream = await client.chat.completions.create({ model: 'speed', // Parallel model name messages: [ { role: 'user', content: 'What does Parallel Web Systems do?' } ], stream: true, response_format: { type: 'json_schema', json_schema: { name: 'reasoning_schema', schema: { type: 'object', properties: { reasoning: { type: 'string', description: 'Think step by step to arrive at the answer', }, answer: { type: 'string', description: 'The direct answer to the question', }, citations: { type: 'array', items: { type: 'string' }, description: 'Sources cited to support the answer', }, }, }, }, }, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content || ''); } process.stdout.write('\\n');}main();
While the OpenAI SDK automatically manages headers, here is the complete list of headers supported by Parallel’s API for developers who need to work with them directly.