Skip to main content
POST
/
users
/
{user_id}
/
chat
/
completions
Create chat completion
curl --request POST \
  --url https://production.api.onvy.health/users/{user_id}/chat/completions \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "messages": [
    {
      "role": "system",
      "content": "<string>"
    }
  ],
  "model": "<string>",
  "temperature": 1,
  "max_tokens": 2,
  "stream": true,
  "top_p": 0.5,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "exclude_context": [
    "all"
  ]
}
'
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "<string>",
        "content": "<string>"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Path Parameters

user_id
string
required

User ID (e.g., google_104940819145861640201)

Body

application/json

Chat completion request

messages
object[]
required
model
string

Model to use for completion

temperature
number
Required range: 0 <= x <= 2
max_tokens
integer
Required range: x >= 1
stream
boolean

Whether to stream the response

top_p
number
Required range: 0 <= x <= 1
frequency_penalty
number
Required range: -2 <= x <= 2
presence_penalty
number
Required range: -2 <= x <= 2
exclude_context
enum<string>[]

Context sections to omit from automatic enrichment:

  • all: skip all enrichment (system prompt + knowledge); keep messages unchanged
  • knowledge: skip retrieval of knowledge base context and links
  • scores: omit recent score summaries from the system prompt
  • workouts: omit recent workout/activity summaries
  • baselines: omit baseline medians/ranges from the system prompt
  • facts: omit long-term personal facts/profile information
  • notes: omit helper notes explaining metrics and data columns
  • language: omit user language; fall back to default
Available options:
all,
knowledge,
scores,
workouts,
baselines,
facts,
notes,
language

Response

Chat completion created successfully

id
string
required

Unique identifier for the completion

object
string
required
created
integer
required

Unix timestamp

model
string
required

Model used for the completion

choices
object[]
required
usage
object