Skip to content

Chat completions

POST /v1/chat/completions

OpenAI-compatible chat completion against your LLM deployment. Supports streaming (SSE) and multimodal messages content (e.g. image_url parts) when the deployed model is a vision-language model.

FieldTypeDefaultNotes
modelstring(the deployment’s model)Optional. If set, must match the endpoint’s model id
messagesarrayrequiredOpenAI message objects; content parts (vision) pass through
streamboolfalseSSE token stream
temperaturefloatengine default
max_tokensintengine default
top_pfloatengine default
frequency_penalty / presence_penaltyfloatengine default
stopstring | string[]
nint1

Any other OpenAI field (tools, tool_choice, response_format, seed, logprobs, user, …) is passed through to the inference engine rather than rejected — support depends on the deployed model/engine.

Terminal window
curl https://<your-deployment>.inference.meshive.ai/v1/chat/completions \
-H "Authorization: Bearer $MESHIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain KV cache in one paragraph."}
],
"stream": true
}'

The response (and stream chunk) schema is OpenAI’s — choices, usage, finish_reason, etc.

  • Rate limits: counts toward the key’s RPM, and usage tokens count toward its TPD. Success responses carry X-RateLimit-Remaining / X-RateLimit-Reset; over-limit returns 429 + Retry-After (details).
  • Timeout: a single request times out after 120s at the gateway.
  • Mid-stream failures emit a final data: {"error": ...} event before the stream closes — handle it when consuming SSE manually.
  • Paused / no capacity: 503 (paused deployments say so; credit exhaustion returns insufficient_quota).
Status · codeMeaning
400model set but doesn’t match this endpoint’s model
401 / 402Bad key / credit exhausted
404Not a deployment endpoint, or model not found
429 rate_limit_errorRPM or TPD exceeded — wait Retry-After
503Deployment paused or no replica available