API reference
Chat completions
POST /v1/chat/completions: the request body, the response, and code in several languages.
Endpoint
Sends a conversation to your instance and returns the model's next message. It follows the OpenAI chat completions format, so OpenAI SDKs and tools work as they are.
Show examples for
Request body
A JSON object. Other OpenAI parameters not listed here are passed to the model server as you send them.
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Any name works: each instance serves one model, and the proxy sends the name your instance serves. Using the model id below keeps your logs readable. |
| messages | array | Yes | Chat turns: [{ "role": "system" | "user" | "assistant", "content": "..." }, ...]. |
| stream | boolean | No | true streams the reply as server-sent events. Token usage arrives in the last chunk. |
| max_tokens | integer | No | Upper limit on the reply's length, in tokens. |
| temperature | number | No | Sampling temperature (0–2). Leave it out to use the model's default. |
| top_p | number | No | Nucleus sampling (0–1). Often used with temperature. |
| stop | string | array | No | Text that ends the reply when the model writes it. |
{
"model": "deepseek-v4.1-flash-uncensored",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"temperature": 1,
"top_p": 0.95,
"max_tokens": 512
}About the model field
Each instance serves one model, so you can send any name: we replace it with the name your instance serves. Using the model id (here deepseek-v4.1-flash-uncensored) keeps your logs readable. See Models.
Response
A standard OpenAI chat completion. Read the reply from choices[0].message.content.
| Field | Meaning |
|---|---|
| id | An id for this completion. |
| object | Always "chat.completion". |
| created | When it was made, in Unix seconds. |
| model | The model your instance serves. |
| choices[].message.content | The reply text. |
| choices[].finish_reason | "stop" when the model finished, "length" when it hit max_tokens. |
| usage | prompt_tokens, completion_tokens and total_tokens for this request. |
{
"id": "chatcmpl-example",
"object": "chat.completion",
"created": 1779715432,
"model": "deepseek-v4.1-flash-uncensored",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The assistant reply is in choices[0].message.content."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 48,
"total_tokens": 60
}
}Code examples
curl -s https://openllmbuddy-proxy.openllmbuddy.workers.dev/v1/chat/completions \
-H 'Authorization: Bearer ob_sk_000000000000000000000000000000000000000000000001' \
-H 'Content-Type: application/json' \
-d '{"model":"deepseek-v4.1-flash-uncensored","messages":[{"role":"user","content":"Hello!"}]}'Tip
Long replies take time. Set your client's timeout to a few minutes, or use streaming to see the reply as it is written.