API reference
Chat completions
POSThttps://api.offmem.app/v1/chat/completions
Generates a model response in the OpenAI Chat Completions format. Works with the official OpenAI SDKs.
curl https://api.offmem.app/v1/chat/completions \
-H "Authorization: Bearer $OFFMEM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "offmem-glm-5.3-flash-abliterated",
"messages": [{"role": "user", "content": "Explain what an API is in one sentence."}]
}'Headers
AuthorizationBearer om_...required- API key.
x-api-keyalso works. Content-Typeapplication/jsonrequired- JSON body.
Body
modelstringrequired- Model ID. See Models.
messagesarrayrequired- Conversation in the OpenAI format (
system,user,assistant,tool). Cannot be empty.image_urlparts only on models with vision. streamboolean- Returns the answer in parts, as server-sent events. Default
false. stream_options.include_usageboolean- With
stream, adds a last event withusage. max_completion_tokens, max_tokensinteger- Output token limit. Also used to reserve balance before the call; without it, the reserve assumes 4,096 output tokens.
ninteger- Only
1. Other values return400 invalido. tools, tool_choicearray, string | object- Function calling in the OpenAI format, forwarded to the model.
temperature, top_p, stop, …- Other OpenAI parameters are forwarded to the model as sent. Support depends on the model.
Removed fields
store, metadata, user and safety_identifier are discarded before the request reaches the model.Response
An OpenAI chat.completion object. model is the offmem ID, and usage has only token counts: prompt_tokens, completion_tokens, total_tokens, prompt_tokens_details.cached_tokens and completion_tokens_details.reasoning_tokens, when the model reports them.
{
"id": "...",
"object": "chat.completion",
"created": 1762560000,
"model": "offmem-glm-5.3-flash-abliterated",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "..." },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 32,
"total_tokens": 50,
"prompt_tokens_details": { "cached_tokens": 0 }
}
}x-offmem-request-idheader- Request ID, the same one shown in the console.
Streaming
With "stream": true the response is text/event-stream: chat.completion.chunk events and a final data: [DONE]. The usage event only comes when stream_options.include_usage is true.
curl -N https://api.offmem.app/v1/chat/completions \
-H "Authorization: Bearer $OFFMEM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "offmem-glm-5.3-flash-abliterated",
"stream": true,
"stream_options": {"include_usage": true},
"messages": [{"role": "user", "content": "Explain what an API is in one sentence."}]
}'Events
data: {"id":"...","object":"chat.completion.chunk","model":"offmem-glm-5.3-flash-abliterated","choices":[{"index":0,"delta":{"content":"..."}}]}
data: {"id":"...","object":"chat.completion.chunk","model":"offmem-glm-5.3-flash-abliterated","choices":[],"usage":{"prompt_tokens":18,"completion_tokens":32,"total_tokens":50}}
data: [DONE]If the connection is closed before the end, the request is billed by estimate: the input plus what was already delivered.
Duration
A request can run for up to 300 seconds.