Send a JSON request to POST /v1/chat/completions with Authorization: Bearer YOUR_API_KEY.

Parameters

ParameterRequiredMeaning
modelYesExact model ID from the current model list.
messagesYesConversation history and current input, with role and content for each message. Common roles are system, user, and assistant.
temperatureNoSampling temperature; range and default depend on the selected model.
streamNoSet to true to receive incremental output where supported.
max_tokensNoMaximum output token count.
toolsNoTool or function definitions, where supported.
reasoning_effortNoModel-specific reasoning level, commonly low, medium, or high where supported.
Select the model through Models API. Do not assume all models accept the same optional parameters. See Usage and costs for how conversation history affects input consumption.