Chat completions
The primary way to call LLMRPM. Send an OpenAI-shaped request body and get an OpenAI-shaped response back, regardless of which model actually served it.
Request body
LLMRPM forwards your request body to the target model without reshaping it, so any field your chosen model supports is passed through. The fields below are the ones you'll use on nearly every request:
| Field | Type | Description |
|---|---|---|
| model | string, required | A model ID from the model catalog, e.g. claude-sonnet-5 or gpt-5.6-luna. |
| messages | array, required | Standard OpenAI message objects with role and content. |
| stream | boolean, optional | Set true to receive the response as server-sent events. See Streaming below. |
| max_tokens | number, optional | Upper bound on tokens generated, forwarded to the target model as-is. |
| temperature | number, optional | Sampling temperature, forwarded to the target model as-is. |
| tools | array, optional | OpenAI-format function/tool definitions, forwarded transparently for models that support tool calling. |
cURL
curl https://llmrpm.com/api/v1/chat/completions \
-H "Authorization: Bearer $LLMRPM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [{ "role": "user", "content": "Hello" }]
}'Node — openai
Point the SDK's baseURL at LLMRPM and use your LLMRPM key — everything else about your existing integration stays the same.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://llmrpm.com/api/v1",
apiKey: process.env.LLMRPM_API_KEY,
});
const response = await client.chat.completions.create({
model: "claude-sonnet-5",
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0].message.content);Python — openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://llmrpm.com/api/v1",
api_key=os.environ["LLMRPM_API_KEY"],
)
response = client.chat.completions.create(
model="claude-sonnet-5",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)Tool calling works the same way as a direct OpenAI integration — set tools on the request and LLMRPM forwards it to the target model:
curl https://llmrpm.com/api/v1/chat/completions \
-H "Authorization: Bearer $LLMRPM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"messages": [{ "role": "user", "content": "What is the weather in Boston?" }],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"parameters": { "type": "object", "properties": { "location": { "type": "string" } } }
}
}]
}'Streaming
Set stream: true to receive the response as server-sent events. LLMRPM forwards each chunk from the upstream model as it arrives rather than buffering the full response, so first-token latency matches calling the model directly.
curl https://llmrpm.com/api/v1/chat/completions \
-H "Authorization: Bearer $LLMRPM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [{ "role": "user", "content": "Count to five." }],
"stream": true
}'Each event is a line beginning with data: followed by a JSON chunk; the stream ends with a final data: [DONE] line. The OpenAI SDK handles this parsing for you — iterate the returned stream directly:
const stream = await client.chat.completions.create({
model: "claude-sonnet-5",
messages: [{ role: "user", content: "Count to five." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}data: prefix, stop at [DONE], andJSON.parse everything else.