Skip to main content

Chat Completions

Create Chat Completion

POST/v1/chat/completions

Generate a text completion.


Request

curl -X POST https://api.ig1.ai/v1/chat/completions \
-H "Authorization: Bearer $IG1AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen35-397b-a17b-instruct-general",
"messages": [
{ "role": "user", "content": "Write me a nice poem about DevOps." }
]
}'

Request body

ParameterTypeRequiredDescription
modelstringModel ID (see LLM Models)
messagesarrayArray of message objects (role + content)
streambooleanEnable streaming (true/false)
temperaturefloatSampling temperature
top_pfloatNucleus sampling
max_tokensintegerMaximum tokens to generate

Extra sampling parameters

The following additional sampling parameters are supported:

ParameterTypeDescription
use_beam_searchboolEnables beam search over sampling.
top_kintLimits sampling to top K tokens (1 to Vocabulary_size).
min_pfloatMinimum probability relative to top token (0.0 to 1.0).
repetition_penaltyfloatPenalizes repeated tokens (from 1.0).
length_penaltyfloatAdjusts sequence length in beam search (from 0.0 to 2.0+).
stop_token_idslist[int]Tokens that trigger generation end (e.g., []).
include_stop_str_in_outputboolKeeps stop strings in final text.
ignore_eosboolForces generation past EOS token.
min_tokensintMinimum tokens to generate (0 to max_tokens).
skip_special_tokensboolRemoves special tokens from output.
spaces_between_special_tokensboolAdds spacing between special tokens.
truncate_prompt_tokensintLimits prompt length by truncating (from 1 to max_context).
prompt_logprobsintReturns logprobs for prompt tokens (e.g., null).
allowed_token_idslist[int]Restricts output to specific tokens (typical values: 0 to 5).
bad_wordslist[string]Prohibits specific words in output.

Response

{
"id": "chatcmpl-beb77eb36e222299",
"object": "chat.completion",
"created": 1773745771,
"model": "qwen35-397b-a17b-instruct-general",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "In silos deep where code once slept..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 22,
"completion_tokens": 316,
"total_tokens": 338
}
}

Unsupported OpenAI endpoints

warning

IG1 AI does not store any chat history or data. That is why following endpoints are not supported:

  • GET/v1/chat/completions
  • GET/v1/chat/completions/{id}
  • POST/v1/chat/completions/{id}
  • DELETE/v1/chat/completions/{id}