Get API key

Chat completions

The primary inference endpoint. OpenAI-shape requests and responses.

POST /v1/chat/completions is the primary inference endpoint. Click Try it on the cURL tab to run against the demo API.

curl -s "https://api.privatemind.com/v1/chat/completions" \
  -H "Authorization: Bearer $PMIND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "fast",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user",   "content": "Explain the CAP theorem."}
    ],
    "temperature": 0.2,
    "max_tokens": 400
  }'
from openai import OpenAI

client = OpenAI(
    base_url="https://api.privatemind.com/v1",
    api_key="PMIND...:abcdef...",
)

resp = client.chat.completions.create(
    model="fast",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user",   "content": "Explain the CAP theorem."},
    ],
    temperature=0.2,
    max_tokens=400,
)
print(resp.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://api.privatemind.com/v1',
  apiKey: process.env.PMIND_KEY,
});

const resp = await client.chat.completions.create({
  model: 'fast',
  messages: [
    { role: 'system', content: 'You are a concise assistant.' },
    { role: 'user',   content: 'Explain the CAP theorem.' },
  ],
  temperature: 0.2,
  max_tokens: 400,
});
console.log(resp.choices[0].message.content);

Parameters

  • model (required): id of a model returned by GET /v1/models.
  • messages (required): conversation so far. Each entry has a role (system, user, assistant, or tool) and a content string. For multimodal inputs, content may be an array. See Vision.
  • temperature (default 1.0): sampling temperature, 0–2. Lower is more deterministic.
  • top_p (default 1.0): nucleus sampling cutoff.
  • max_tokens: maximum tokens to generate. Hard ceiling is the model's context_length minus the prompt.
  • stream (default false): when true, response is delivered as SSE chunks. See Streaming.
  • stop: up to four stop sequences.
  • tools: function definitions the model may call. See Tool use.
  • reasoning_effort: "off", "low", "medium", or "high". Switches thinking on/off on hybrid models. See Reasoning effort below for the full behaviour matrix.
  • include_reasoning (default true): set false to leave the model's reasoning out of the response. The model still thinks and the tokens are still billed. See Streaming → Reasoning output.
  • metadata: an OpenAI-shape map of up to 16 string→string tags (keys ≤64 chars, values ≤512) for attributing the call. Stored on the usage row and never forwarded to the model; query or roll up by it later. See Usage → Tagging requests.

Additional OpenAI fields (presence_penalty, frequency_penalty, response_format, seed) are forwarded to the engine. Honour depends on the model: check supported_parameters in GET /v1/models.

The whole request body, base64 media included, can be up to 64 MB. A larger body gets 413 with error.code request_too_large.

Reasoning effort

reasoning_effort (optional) is the standard way to switch a model's thinking on or off without passing raw chat_template_kwargs. Allowed values:

Value Meaning
"off" Disable thinking. Only on models without reasoning_mandatory.
"low" Enable thinking at the lightest depth this deployment honours.
"medium" Enable thinking at a middle depth.
"high" Enable thinking at a deeper setting.
"max" Enable thinking at the deepest setting the deployment honours.

Which of these a given model actually distinguishes is published as capabilities.reasoning_effort_levels. Read that list rather than assuming all five are separate rungs. A value outside it gets the model's general thinking setting where the deployment declares one, which is most of them; a deployment that defines only specific levels returns 400 for any other level. On a thinking-only model with no level dial, any value other than "off" is accepted and changes nothing. A model that publishes no reasoning_effort capability has no runtime contract: every value, "off" included, is accepted and ignored, and the model behaves as it does by default.

What the API does with the value depends on the model's runtime mode (see Models):

Runtime mode Example models "off" Any enabling value
Hybrid Qwen 3.8 27B Disables thinking Enables thinking, at the depth the level maps to
Thinking-only Kimi K3, GLM 5.3 Flash 400 Sets the depth; thinking cannot be turned off
Non-thinking None in the catalog today Accepted, no effect 400
No runtime contract None in the catalog today Accepted, no effect Accepted, no effect

Thinking-only means the model always thinks, not that the level is ignored. Both thinking-only models above honour their published levels.

Note

Omit reasoning_effort to get the model's default, published as capabilities.reasoning_effort_default where the deployment declares one.

cURL
curl -s "https://api.privatemind.com/v1/chat/completions" \
  -H "Authorization: Bearer $PMIND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "reasoning",
    "messages": [{"role": "user", "content": "Plan a four-step proof of Pythagoras."}],
    "reasoning_effort": "low"
  }'
Tip

Power users can still pass chat_template_kwargs directly. If you send both, the raw kwargs take precedence over reasoning_effort. Use that when you need a parameter the canonical field doesn't cover.

Response

JSON
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "<model-id>",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "The CAP theorem ..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 128,
    "total_tokens": 170
  }
}

usage.prompt_tokens and usage.completion_tokens are what your key is billed against.

Prompt caching

Models hosted by PrivateMind keep recently processed prompts in a cache. When a request starts with the same content as an earlier one, that shared start is read from the cache instead of being processed again, and the response begins sooner. There is nothing to switch on. The gain is largest on long prompts: a follow-up in a long conversation, or a large document you ask several questions about.

The cache matches from the first token forward and stops at the first difference, so the order of your request matters:

  • Keep the system prompt and tool definitions identical from one request to the next. Put anything that changes per request, such as the current time or a request id, in the last message rather than the system prompt.
  • In a conversation, send the earlier messages back exactly as they were and append the new ones. Editing, trimming or reordering an earlier message means everything after it is processed again.
  • When asking several questions about the same document, put the document first and the question after it.

usage.prompt_tokens_details.cached_tokens reports how much of the prompt was read from the cache:

JSON
"usage": {
  "prompt_tokens": 6060,
  "completion_tokens": 5,
  "total_tokens": 6065,
  "prompt_tokens_details": { "cached_tokens": 3200 }
}

The cache works in fixed-size blocks, so cached_tokens is usually a little below the length of the shared start. A hit is likely, not guaranteed: under heavy load older entries are dropped to make room, and the next request with that prefix is processed in full. On a streamed response the same field arrives in the final chunk's usage.

Finish reasons

Value Meaning
stop Natural end of generation or a stop sequence matched
length Hit max_tokens or the context window
tool_calls The model wants to call one or more tools. See Tool use
content_filter Output was blocked by a safety filter

Where next

  • Streaming for the SSE variant of this endpoint.
  • Tool use for function calling on top of chat completions.
  • Vision for the multimodal content-array shape.
  • Models for capability discovery against your org's catalog.