Home / Servers / OpenAI API / create_chat_completion

Create chat completion

An MCP tool from the OpenAI API server, hosted on mcp.hjlabs.in.

Create chat completion **Starting a new project?** We recommend trying Responses to take advantage of the latest OpenAI platform features. Compare Chat Completions with Responses. --- Creates a model response for the… [POST /chat/completions]

Name on the gateway: openai_api__create_chat_completion · may change things.

Parameters

NameTypeDescription
metadataobjectSet of 16 key-value pairs that can be attached to an object. This can be…
top_logprobsintegerAn integer between 0 and 20 specifying the maximum number of most likely…
temperaturenumberWhat sampling temperature to use, between 0 and 2. Higher values like 0.8 will…
top_pnumberAn alternative to sampling with temperature, called nucleus sampling, where…
userstringThis field is being replaced by safety_identifier and prompt_cache_key. Use…
safety_identifierstringA stable identifier used to help detect users of your application that may be…
prompt_cache_keystringUsed by OpenAI to cache responses for similar requests to optimize your cache…
prompt_cache_retentionin_memory | 24hDeprecated. Use prompt_cache_options.ttl instead. The retention policy for the…
prompt_cache_optionsobjectOptions for prompt caching. Supported for gpt-5.6 and later models. By…
messages requiredarrayA list of messages comprising the conversation so far. Depending on the model…
model requiredstringModel ID used to generate the response, like gpt-6-astra or o3. OpenAI offers…
service_tierauto | default | flex | scale | priority | fastSpecifies the processing type used for serving the request. - If set to…
modalitiesarrayOutput types that you would like the model to generate. Most models are…
verbositylow | medium | highConstrains the verbosity of the model's response. Lower values will result in…
reasoning_effortnone | minimal | low | medium | high | xhigh | maxConstrains effort on reasoning for reasoning models. Currently supported…
max_completion_tokensintegerAn upper bound for the number of tokens that can be generated for a…
frequency_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on…
presence_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on…
web_search_optionsobjectThis tool searches the web for relevant results to use in a response. Learn…
response_formatobjectAn object specifying the format that the model must output. Setting to {…
audioobjectParameters for audio output. Required when audio output is requested with…
storebooleanWhether or not to store the output of this chat completion request for use in…
moderationobjectConfiguration for running moderation on the request input and generated output.
streambooleanIf set to true, the model response data will be streamed to the client as it…
stopstringNot supported with latest reasoning models o3 and o4-mini. Up to 4 sequences…
logit_biasobjectModify the likelihood of specified tokens appearing in the completion. Accepts…
logprobsbooleanWhether to return log probabilities of the output tokens or not. If true…
max_tokensintegerThe maximum number of tokens that can be generated in the chat completion.…
nintegerHow many chat completion choices to generate for each input message. Note that…
predictionobjectConfiguration for a Predicted Output, which can greatly improve response times…
seedintegerThis feature is in Beta. If specified, our system will make a best effort to…
stream_optionsobjectOptions for streaming response. Only set this when you set stream: true.
toolsarrayA list of tools the model may call. You can provide either custom tools or…
tool_choiceobjectControls which (if any) tool is called by the model. none means the model will…
parallel_tool_callsbooleanWhether to enable parallel function calling during tool use.
function_callobjectDeprecated in favor of tool_choice. Controls which (if any) function is called…
functionsarrayDeprecated in favor of tools. A list of functions the model may generate JSON…

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "openai_api__create_chat_completion",
  "arguments": {
    "messages": [],
    "model": "…"
  }
}

Or connect the OpenAI API server directly, which lists 371 tools including this one:

Run in your terminal
claude mcp add --transport http hj-openai-api https://mcp.hjlabs.in/mcp/openai-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the create chat completion tool with metadata set to ….

More from OpenAI API