Home / Servers / OpenAI API / create_completion

Create completion

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

Create completion Creates a completion for the provided prompt and parameters. Returns a completion object, or a sequence of completion objects if the request is streamed. [POST /completions]

Name on the gateway: openai_api__create_completion · may change things.

Parameters

NameTypeDescription
model requiredstringID of the model to use. You can use the List models API to see all of your…
prompt requiredstringThe prompt(s) to generate completions for, encoded as a string, array of…
best_ofintegerGenerates best_of completions server-side and returns the "best" (the one with…
echobooleanEcho back the prompt in addition to the completion
frequency_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on…
logit_biasobjectModify the likelihood of specified tokens appearing in the completion. Accepts…
logprobsintegerInclude the log probabilities on the logprobs most likely output tokens, as…
max_tokensintegerThe maximum number of tokens that can be generated in the completion. The…
nintegerHow many completions to generate for each prompt. **Note:** Because this…
presence_penaltynumberNumber between -2.0 and 2.0. Positive values penalize new tokens based on…
seedintegerIf specified, our system will make a best effort to sample deterministically…
stopstringNot supported with latest reasoning models o3 and o4-mini. Up to 4 sequences…
streambooleanWhether to stream back partial progress. If set, tokens will be sent as…
stream_optionsobjectOptions for streaming response. Only set this when you set stream: true.
suffixstringThe suffix that comes after a completion of inserted text. This parameter is…
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…
userstringA unique identifier representing your end-user, which can help OpenAI to…

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_completion",
  "arguments": {
    "model": "…",
    "prompt": "…"
  }
}

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 completion tool with model set to ….

More from OpenAI API