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

POST/api/v1/chat/completions

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:

FieldTypeDescription
modelstring, requiredA model ID from the model catalog, e.g. claude-sonnet-5 or gpt-5.6-luna.
messagesarray, requiredStandard OpenAI message objects with role and content.
streamboolean, optionalSet true to receive the response as server-sent events. See Streaming below.
max_tokensnumber, optionalUpper bound on tokens generated, forwarded to the target model as-is.
temperaturenumber, optionalSampling temperature, forwarded to the target model as-is.
toolsarray, optionalOpenAI-format function/tool definitions, forwarded transparently for models that support tool calling.

cURL

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.

Node — openai
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

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 — tool calling
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 — streaming
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:

Node — streaming
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 ?? "");
}
Note
If you're parsing server-sent events yourself, split on newlines, strip the data: prefix, stop at [DONE], andJSON.parse everything else.