API
Chat Completions
POST /v1/chat/completions is the main text generation endpoint. It accepts the standard OpenAI Chat Completions request and returns the standard response.
Request
curl https://api.llm-hub.dev/v1/chat/completions \
-H "Authorization: Bearer $LLMHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"messages": [
{"role": "system", "content": "Answer in one sentence."},
{"role": "user", "content": "What is idempotency?"}
],
"max_tokens": 200
}'| Field | Description |
|---|---|
model | Model ID from Models. Required. |
messages | Conversation with system, user, assistant, and tool roles. Required. |
max_tokens / max_completion_tokens | Maximum output tokens. |
stop | String or array of strings that end generation. |
stream | Return tokens as Server-Sent Events. See Streaming. |
tools | Functions the model may call. See Tool calling. |
response_format | JSON output. See Structured output. |
Response
{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1790675901,
"model": "gpt-5.6-sol",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "...", "refusal": null, "annotations": []},
"logprobs": null,
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 19,
"total_tokens": 43,
"prompt_tokens_details": {"cached_tokens": 0, "audio_tokens": 0},
"completion_tokens_details": {"reasoning_tokens": 0, "audio_tokens": 0,
"accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0}
},
"service_tier": "default",
"system_fingerprint": null
}finish_reason is stop, length (hit max_tokens), or tool_calls. You are billed for the tokens reported in usage.
Last updated
