Create chat completion
OpenAI-compatible Chat Completions endpoint for 270+ models. Provider-native parameters (thinking, reasoning_effort, etc.) are passed through to the serving provider unchanged.
ApiKeyAuthAuthorization<token>application/json- body
metadata?|nullprompt_cache_key?stringUsed by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.
prompt_cache_retention?|nullsafety_identifier?stringA stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.
length <= 64service_tier?|nulltemperature?|nulltop_logprobs?top_p?|nulluser?stringDeprecatedThis field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations.
A stable identifier for your end-users.
Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.
audio?Parameters for audio output. Required when audio output is requested with
modalities: ["audio"]. Learn more.
frequency_penalty?numberNumber between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
-2 <= value <= 20function_call?|DeprecatedDeprecated in favor of tool_choice.
Controls which (if any) function is called by the model.
none means the model will not call a function and instead generates a
message.
auto means the model can pick between generating a message or calling a
function.
Specifying a particular function via {"name": "my_function"} forces the
model to call that function.
none is the default when no functions are present. auto is the default
if functions are present.
functions?array<>DeprecatedDeprecated in favor of tools.
A list of functions the model may generate JSON inputs for.
1 <= items <= 128logit_bias?Modify the likelihood of specified tokens appearing in the completion.
Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.
nulllogprobs?booleanWhether to return log probabilities of the output tokens or not. If true,
returns the log probabilities of each output token returned in the
content of message.
falsemax_completion_tokens?integerAn upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
max_tokens?integerDeprecatedThe maximum number of tokens that can be generated in the chat completion. This value controls the maximum generated tokens.
This value is now deprecated in favor of max_completion_tokens, and is
not compatible with o-series models.
messages*array<|||||>modalities?array<>|nullmodel*|Model ID used to generate the response, like gpt-4o or o3. OpenAI
offers a wide range of models with different capabilities, performance
characteristics, and latency profiles. Refer to the model guide
to browse and compare available models.
n?integerHow many chat completion choices to generate for each input message. Higher values can generate more output tokens.
1 <= value <= 1281parallel_tool_calls?ParallelToolCallsWhether to enable parallel function calling during tool use.
trueprediction?Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content.
presence_penalty?numberNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
-2 <= value <= 20reasoning_effort?|nullresponse_format?||An object specifying the format that the model must output.
Setting to { "type": "json_schema", "json_schema": {...} } enables
Structured Outputs which ensures the model will match your supplied JSON
schema. Learn more in the Structured Outputs
guide.
Setting to { "type": "json_object" } enables the older JSON mode, which
ensures the message the model generates is valid JSON. Using json_schema
is preferred for models that support it.
seed?integerDeprecatedThis feature is in Beta.
If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.
Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend.
-9223372036854776000 <= value <= 9223372036854776000stop?|array<string>Not supported with latest reasoning models o3 and o4-mini.
Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
nullstore?booleanWhether or not to store the output of this chat completion request for use in our model distillation or evals products.
Supports text and image inputs. Note: image inputs over 8MB will be dropped.
falsestream?booleanIf set to true, the model response data will be streamed to the client as it is generated using server-sent events. See the Streaming section below for more information, along with the streaming responses guide for more information on how to handle the streaming events.
falsestream_options?|nulltool_choice?|||Controls which (if any) tool is called by the model.
none means the model will not call any tool and instead generates a message.
auto means the model can pick between generating a message or calling one or more tools.
required means the model must call one or more tools.
Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.
none is the default when no tools are present. auto is the default if tools are present.
tools?array<|>A list of tools the model may call. You can provide either custom tools or function tools.
verbosity?|nullweb_search_options?This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
Successful response
application/json- response
Represents a chat completion response returned by model, based on the provided input.
choices*array<>A list of chat completion choices. Can be more than one if n is greater than 1.
created*integerThe Unix timestamp (in seconds) of when the chat completion was created.
id*stringA unique identifier for the chat completion.
model*stringThe model used for the chat completion.
object*"chat.completion"The object type, which is always chat.completion.
"chat.completion"service_tier?|nullsystem_fingerprint?stringDeprecatedThis fingerprint represents the backend configuration that the model runs with.
Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might impact determinism.
usage?What this request cost. All amounts are in Credits, not USD.
provider?stringThe provider that served the request.
curl -X POST 'https://api.ohmygpt.com/v1/chat/completions' \ -H 'Content-Type: application/json' \ -d '{ "messages": [ { "content": "string", "role": "developer" } ], "model": "string"}'{ "created": 0, "id": "string", "model": "string", "object": "chat.completion", "service_tier": "auto", "system_fingerprint": "string", "provider": "string", "usage": { "completion_tokens": 0, "completion_tokens_details": { "accepted_prediction_tokens": 0, "audio_tokens": 0, "reasoning_tokens": 0, "rejected_prediction_tokens": 0 }, "prompt_tokens": 0, "prompt_tokens_details": { "audio_tokens": 0, "cached_tokens": 0 }, "total_tokens": 0, "billing_mode": "platform", "cost": 0, "is_byok": true }, "choices": [ { "native_finish_reason": "string" } ]}Count input tokens POST
Counts the input tokens of a Messages request without running it. Takes the same body as `POST /v1/messages`. The count is model-specific (4.7+ use a new tokenizer, roughly 30% more tokens for the same text) and free to use.
Create message POST
Anthropic Messages API endpoint. Supports extended_thinking, tool_use, cache_control, and other native features. Non-Anthropic models are automatically handled via cross-protocol translation.