Skip to main content
POST
Use Authorization: Bearer $PIPELLM_API_KEY. Pick model from GET /v1/models.

Endpoint

This free route accepts OpenAI-compatible requests and routes only to OpenAI-compatible platforms. To keep the OpenAI format while calling Anthropic or Gemini models, use the OpenAI Format Converter.

Code Examples

Request Parameters

Pick model from GET /v1/models. Native /v1/chat/completions only routes to OpenAI-compatible platforms.
string
required
Model ID visible to your account.
array
required
Conversation messages. At least one item.
number
Sampling temperature, 0–2. Default 1.
integer
Maximum tokens to generate.
integer
Preferred maximum for newer OpenAI-compatible models. Use this instead of max_tokens when the model requires it.
boolean
If true, return server-sent events. See Streaming.
object
Streaming extras.
number
Nucleus sampling, 0–1.
integer
Number of completions to generate. Default 1.
string | string[]
Stop sequence or list of stop sequences.
number
Presence penalty, -2 to 2. Default 0.
number
Frequency penalty, -2 to 2. Default 0.
array
Function tools the model may call. See Function Calling.
string | object
auto, none, or {"type":"function","function":{"name":"..."}}.
string
End-user identifier for abuse tracking.

Response Format

string
Completion ID.
string
chat.completion, or chat.completion.chunk when streaming.
string
Model that produced the response.
array
Completion choices.
object
Token counts: prompt_tokens, completion_tokens, total_tokens.

Errors

Same envelope as Errors.
Malformed JSON, missing model / messages, or a protocol mismatch on this native route.
Missing or invalid API key.
Balance check failed before the request was processed.
Account RPM exceeded. See Rate Limits.

Function Calling

Function Calling allows models to generate structured JSON to call functions in your code.

Function Calling Documentation

Complete guide on defining functions and handling responses