Skip to content

Create chat completion

OpenAI-compatible Chat Completions: shared by GPT, Gemini, GLM, Qwen, DeepSeek, Grok and other chat models.

POST/v1/chat/completions

Given a list of messages, returns the model's reply. With the OpenAI SDK, just set the Base URL to https://api.hop-base.com/v1 and use an API key from the matching group.

The table lists only the fields the gateway checks, rewrites or rejects, plus values documented on each model page; OpenAI fields not listed are forwarded as-is, with ranges per the model's official spec. The whole request body is capped at 60 MB; larger bodies return 413.

Headers

Authorization:requiredstring

Bearer sk-…: an API key created in the console under API keys; its group must include the requested model

Body parametersJSON

Model
Fields not listed are passed through unchanged. Pick a model family to see the values and limits its docs specify.
model:requiredstring

A model ID in the current key's group; GET /v1/models is authoritative. If the group does not include the model, returns 404 model_not_found; image models such as gpt-image-* return 400 image models do not support Chat Completions, please use the Images API on this endpoint

messages:requiredarray of object

Conversation messages. Missing returns 400 missing messages field; an empty array returns 400 messages must not be an empty array

Items≥ 1

max_tokens:optionalinteger

Output cap. The gateway does not truncate or rewrite it; the limit follows the model's official spec, and values above it return an error from the model

max_completion_tokens:optionalinteger

Same as max_tokens; the newer OpenAI field name

stream:optionalboolean

true returns SSE; see Streaming events for the event format

Defaultfalse

stream_options:optionalobject

Streaming options

tools:optionalarray of object

Function tools in OpenAI function tools format, forwarded as-is.

tool_choice:optionalstring or object

auto / none / required or a specific function, forwarded as-is

temperature:optionalnumber

Sampling temperature, forwarded as-is; range per the model's official spec

top_p:optionalnumber

Nucleus sampling, forwarded as-is; range per the model's official spec

reasoning_effort:optionalstring

Reasoning effort. Values vary by model; select a model family above to see them

service_tier:optionalstring

Only priority / flex are kept; other values are removed before forwarding, without an error

Valuespriorityflex

Returns

200Success. Non-streaming returns chat.completion JSON; with stream: true it returns SSE (text/event-stream)

id:optionalstring

ID of this completion

object:optional"chat.completion"

Always chat.completion

created:optionalinteger

Unix seconds

model:optionalstring

Model ID actually used

choices:optionalarray of object

Candidate replies; most models return only 1

usage:optionalobject

Token usage

Errors

400Unreadable request body, missing messages, etc.
401Missing, invalid or expired API key (missing_api_key / invalid_api_key / api_key_expired)
402Balance, or key / member / department quota, exhausted (insufficient_quota)
404The model is not in this key's group (model_not_found), or the path does not belong to the group (route_not_found)
413Request body over 60 MB (request_too_large)
429Account or key concurrency cap reached (user_concurrency_limit / apikey_concurrency_limit), with Retry-After

Related