Official Function Calling
- Register callable functions with the model via
tools - The model may decide whether to call a function based on the conversation and return structured arguments
- Compatible with OpenAI Chat Completions Function calling
- Official docs: Tools / Function calling
Authorizations
Request Body
The model to use. See the model endpoint compatibility table for which models work with the Chat API.
List of messages in the conversation so far.
Sampling temperature between 0 and 2. Higher values (e.g. 0.8) make output more random; lower values (e.g. 0.2) make it more focused. We generally recommend changing this or top_p, but not both.
Nucleus sampling alternative to temperature. The model considers tokens with top_p probability mass (e.g. 0.1 = top 10%). We generally recommend changing this or temperature, but not both.
Default 1. How many chat completion choices to generate per input message.
Default false. If set, partial message deltas are sent as in ChatGPT. Tokens are sent as server-sent events and the stream ends with a data: [DONE] message.
Default null. Up to 4 sequences where the API stops generating further tokens.
Default inf. Maximum tokens to generate in the completion.
Total length of input + output tokens is limited by the model context length.
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the chance of new topics. More on frequency and presence penalties.
Default 0. Number between -2.0 and 2.0. Positive values penalize new tokens based on their frequency in the text so far, reducing repetition.
Modify the likelihood of specified tokens appearing in the completion.
Accepts a JSON object mapping token IDs to bias values from -100 to 100. Applied to logits before sampling; effect varies by model.
Unique identifier for your end user. Helps OpenAI monitor and detect abuse. Learn more.
Object specifying the output format. Set { "type": "json_object" } for JSON mode. When using JSON mode, you must also instruct the model to produce JSON via system or user messages.
Beta feature. If set, the system will try to sample deterministically so repeated requests with the same seed and parameters return the same result. Check system_fingerprint in the response to monitor backend changes.
List of tools the model may call. Currently only functions as tools are supported. Provide functions the model can generate JSON input for.
Controls which function the model calls, if any. none = no function call; auto = model chooses; force a function with {"type": "function", "function": {"name": "my_function"}}. Defaults to none if no functions, else auto.