Number 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.
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.
Whether 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.
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.
How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.
Number 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.
This 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.
Required range: -9223372036854776000 <= x <= 9223372036854776000
If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Example Python code.
View the thinking/reasoning tokens as part of your response. Thinking models produce a long internal chain of thought before generating a response. Supported only for specific Claude models on Anthropic, Google Vertex AI, and AWS Bedrock. Requires setting strict_openai_compliance = false in your API call.
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
We generally recommend altering this or top_p but not both.
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or temperature but not both.
A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
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.
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.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Portkey (Prisma AIRS AI Gateway) Docs","description":"Comprehensive documentation for AI Gateway, Guardrails, Observability, and Governance features.","colors":{"primary":"#0891B2","light":"#0891B2","dark":"#0891B2"},"logo":{"light":"https://mintcdn.com/portkey-docs/tHk-hgNjLbEj4dhh/images/portkey-PANW-company-logo-positive.png?fit=max\u0026auto=format\u0026n=tHk-hgNjLbEj4dhh\u0026q=85\u0026s=c5fb09014ff79616583b1d3bffe27450","dark":"https://mintcdn.com/portkey-docs/tHk-hgNjLbEj4dhh/images/portkey-PANW-company-logo-negative.png?fit=max\u0026auto=format\u0026n=tHk-hgNjLbEj4dhh\u0026q=85\u0026s=6025ca49ef544522f58ff471b7f75f8f"},"favicon":"https://mintcdn.com/portkey-docs/Hf1XgyjG_b79ym4Q/favicon.png?fit=max\u0026auto=format\u0026n=Hf1XgyjG_b79ym4Q\u0026q=85\u0026s=cbaa1bfc49bb6e3fd6cf499a5da313a3","api":{"openapi":"https://raw.githubusercontent.com/Portkey-AI/openapi/refs/heads/master/openapi.yaml","examples":{"prefill":true},"url":"full"},"navbar":{"links":[{"href":"https://portkey.ai/models","label":"Models"},{"href":"https://support.portkey.ai/forms/customer-portal-ticket-form","label":"Support"},{"href":"https://www.paloaltonetworks.in/ai-security/ai-gateway?utm_source=portkey\u0026utm_medium=referral\u0026utm_campaign=prisma_airs\u0026utm_content=docs_nav#contact","label":"Contact Us"}],"primary":{"type":"button","label":"Sign in","href":"https://stratacloudmanager.paloaltonetworks.com/"}},"footer":{"socials":{"x":"https://twitter.com/PortkeyAI","linkedin":"https://www.linkedin.com/company/portkey-ai","github":"https://git.new/portkey"},"links":[{"header":"For LLMs","items":[{"label":"llms.txt","href":"https://portkey.ai/docs/llms.txt"},{"label":"llms-full.txt","href":"https://portkey.ai/docs/llms-full.txt"}]},{"header":"Products","items":[{"label":"Observability","href":"https://portkey.ai/features/observability"},{"label":"AI Gateway","href":"https://portkey.ai/features/ai-gateway"},{"label":"Guardrails","href":"https://portkey.ai/features/guardrails"},{"label":"Prompt Management","href":"https://portkey.ai/features/prompt-management"},{"label":"Agents","href":"https://portkey.ai/features/agents"},{"label":"MCP Gateway","href":"https://portkey.ai/docs/product/mcp-gateway"},{"label":"Security","href":"https://portkey.ai/features/security-and-compliance"},{"label":"Auto-Instrumentation","href":"https://portkey.ai/features/auto-instrumentation"}]},{"header":"Resources","items":[{"label":"API Status","href":"https://status.portkey.ai/"},{"label":"Helm Charts","href":"https://github.com/portkey-ai/helm"},{"label":"AI Grants Finder","href":"https://grantsfinder.portkey.ai/"},{"label":"Events Calendar","href":"https://lu.ma/portkey"},{"label":"Blog","href":"https://portkey.ai/blog"},{"label":"Error Library","href":"https://portkey.ai/error-library"},{"label":"Models \u0026 Pricing","href":"https://portkey.ai/models"}]},{"header":"Company","items":[{"label":"Pricing","href":"https://portkey.ai/pricing"},{"label":"Compliances","href":"https://trust.portkey.ai/"},{"label":"Privacy Policy","href":"https://portkey.ai/privacy-policy"},{"label":"Terms of Service","href":"https://portkey.ai/terms"},{"label":"DPA","href":"https://portkey.ai/dpa"},{"label":"Cookie Policy","href":"https://portkey.ai/cookie-policy"}]}]},"seo":{"metatags":{"og:type":"website","og:site_name":"Portkey AI Gateway Docs"},"indexing":"navigable"},"styling":{"eyebrows":"breadcrumbs","codeblocks":"system","latex":true},"integrations":{"ga4":{"measurementId":"G-JJMXYE4DRL"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"toc"},"interaction":{"drilldown":true},"metadata":{"timestamp":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"portkey-docs","hasAudioNarration":false,"actualSubdomain":"portkey-docs","customDomains":["docs.portkey.ai","portkey.ai"],"gitSource":{"type":"github","owner":"portkey-ai","repo":"docs-core","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae208355ca9b4a2f463da8b","collectionId":"90268a13-2a6c-48fb-8f39-0cf354671ab3","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae208355ca9b4a2f463da8b"},"feedback":{"thumbs":true,"edits":true,"issues":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae208355ca9b4a2f463da8b","clientVersion":"0.0.4006","searchFilterCounts":[{"language":"default","tag":"Integrations","count":697},{"language":"default","tag":"Product","count":382},{"language":"default","tag":"Docs","count":320},{"language":"default","tag":"LLM Integrations","count":307},{"language":"default","tag":"More","count":176},{"language":"default","tag":"Admin APIs","count":172},{"language":"default","tag":"Guardrails","count":101},{"language":"default","tag":"AI Gateway","count":99},{"language":"default","tag":"Admin API","count":95},{"language":"default","tag":"Documentation","count":91}],"searchSettings":{"isFiltersEnabled":true,"showContentSnippets":true}},"assistantConfig":{"enableAskAiButton":true,"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@portkey.ai","showHelpButton":true}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#banner{background:linear-gradient(90deg,#0d1b2e 0,#1a1040 40%,#2d0f22 100%);border-bottom:1px solid rgba(255,255,255,.08)}#banner a{color:#f0f0f0;text-decoration:none;font-weight:600;border-bottom:1px solid rgba(240,240,240,.5);padding-bottom:1px;transition:border-color .2s ease}#banner a:hover{border-bottom-color:#fff}"}],"page":{"pagePath":"api-reference/inference-api/chat","slug":"/api-reference/inference-api/chat","pageMetadata":{"title":"Chat","openapi":"post /chat/completions","description":"","href":"/api-reference/inference-api/chat"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={hr:`hr`,p:`p`,..._provideComponents(),...props.components},{Card}=_components;if(!Card)_missingMdxReference(`Card`,true);return _jsxs(_Fragment,{children:[_jsx(_components.hr,{}),`\n`,_jsx(Card,{title:`Portkey is now PRISMA AIRS AI Gateway. See it in action.`,href:`https://www.paloaltonetworks.in/ai-security/ai-gateway?utm_source=portkey\u0026utm_medium=referral\u0026utm_campaign=prisma_airs\u0026utm_content=docs_nav#contact`,icon:`arrow-up-right-from-square`,children:_jsx(_components.p,{children:`Contact Us`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"title":"Chat","openapi":"post /chat/completions","description":"","href":"/api-reference/inference-api/chat"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"operationId":"createChatCompletion","tags":["Chat"],"summary":"Chat","parameters":["c6a71233-d439-47aa-9456-6fee06d77595","59bad3d3-ad5a-4eaa-a39a-03a3431a83e4","b2baeb62-8781-429a-883f-def835435b31","a9838c94-0d4d-4478-af96-e22d3a441613","8f882219-cf47-432c-98fb-33fd6fa17b64","17297681-c47d-4001-a1ec-7bcb5dfe6256","a286be96-37d9-4eb5-9ba4-2ba8c414dba4"],"requestBody":"03dda38f-797b-4dfa-b2aa-8b4cb4aba92f","responses":{"200":"f71fb723-0393-486d-b456-ea439761d280"},"security":["18c99ab0-4523-4ce1-99b8-c3e8981a63ff","c6d17183-3e07-435b-8177-4d17999eefa2","35f52312-a38c-499c-ade5-1bc03cfb18fb","606e28de-2f31-4ea4-a031-04c5a1eccc37"],"x-code-samples":[{"lang":"cURL","label":"Default","source":"curl https://api.portkey.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\" \\\n -d '{\n \"model\": \"gpt-5\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"max_completion_tokens\": 250\n }'\n"},{"lang":"cURL","label":"Self-Hosted","source":"curl SELF_HOSTED_GATEWAY_URL/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\" \\\n -d '{\n \"model\": \"gpt-5\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"max_completion_tokens\": 250\n }'\n"},{"lang":"python","label":"Default","source":"from portkey_ai import Portkey\n\nportkey = Portkey(\n api_key = \"PORTKEY_API_KEY\",\n virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nresponse = portkey.chat.completions.create(\n model=\"gpt-5\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n max_completion_tokens=250\n)\n\nprint(response.choices[0].message)\n"},{"lang":"python","label":"Self-Hosted","source":"from portkey_ai import Portkey\n\nportkey = Portkey(\n api_key = \"PORTKEY_API_KEY\",\n base_url = \"SELF_HOSTED_GATEWAY_URL\",\n virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nresponse = portkey.chat.completions.create(\n model=\"gpt-5\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n max_completion_tokens=250\n)\n\nprint(response.choices[0].message)\n"},{"lang":"javascript","label":"Default","source":"import Portkey from 'portkey-ai';\n\nconst portkey = new Portkey({\n apiKey: 'PORTKEY_API_KEY',\n virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n const response = await portkey.chat.completions.create({\n messages: [{ role: \"system\", content: \"You are a helpful assistant.\" }],\n model: \"gpt-5\",\n max_completion_tokens: 250,\n });\n\n console.log(response.choices[0]);\n}\n\nmain();\n"},{"lang":"javascript","label":"Self-Hosted","source":"import Portkey from 'portkey-ai';\n\nconst portkey = new Portkey({\n apiKey: 'PORTKEY_API_KEY',\n virtualKey: 'PROVIDER_VIRTUAL_KEY',\n baseUrl: 'SELF_HOSTED_GATEWAY_URL'\n});\n\nasync function main() {\n const response = await portkey.chat.completions.create({\n messages: [{ role: \"system\", content: \"You are a helpful assistant.\" }],\n model: \"gpt-5\",\n max_completion_tokens: 250,\n });\n\n console.log(response.choices[0]);\n}\n\nmain();\n"}],"method":"post","type":"path","servers":["6b105cf4-7388-4de1-879b-d584706b8eb7","b96d32e1-039c-450a-9fa6-db0711977e64"],"path":"/chat/completions","baseUrlOptions":["https://api.portkey.ai/v1","SELF_HOSTED_GATEWAY_URL"],"title":"Chat","description":"","codeSamples":[{"label":"Default","lang":"cURL","source":"curl https://api.portkey.ai/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\" \\\n -d '{\n \"model\": \"gpt-5\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"max_completion_tokens\": 250\n }'\n"},{"label":"Self-Hosted","lang":"cURL","source":"curl SELF_HOSTED_GATEWAY_URL/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\" \\\n -d '{\n \"model\": \"gpt-5\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ],\n \"max_completion_tokens\": 250\n }'\n"},{"label":"Default","lang":"python","source":"from portkey_ai import Portkey\n\nportkey = Portkey(\n api_key = \"PORTKEY_API_KEY\",\n virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nresponse = portkey.chat.completions.create(\n model=\"gpt-5\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n max_completion_tokens=250\n)\n\nprint(response.choices[0].message)\n"},{"label":"Self-Hosted","lang":"python","source":"from portkey_ai import Portkey\n\nportkey = Portkey(\n api_key = \"PORTKEY_API_KEY\",\n base_url = \"SELF_HOSTED_GATEWAY_URL\",\n virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nresponse = portkey.chat.completions.create(\n model=\"gpt-5\",\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n max_completion_tokens=250\n)\n\nprint(response.choices[0].message)\n"},{"label":"Default","lang":"javascript","source":"import Portkey from 'portkey-ai';\n\nconst portkey = new Portkey({\n apiKey: 'PORTKEY_API_KEY',\n virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n const response = await portkey.chat.completions.create({\n messages: [{ role: \"system\", content: \"You are a helpful assistant.\" }],\n model: \"gpt-5\",\n max_completion_tokens: 250,\n });\n\n console.log(response.choices[0]);\n}\n\nmain();\n"},{"label":"Self-Hosted","lang":"javascript","source":"import Portkey from 'portkey-ai';\n\nconst portkey = new Portkey({\n apiKey: 'PORTKEY_API_KEY',\n virtualKey: 'PROVIDER_VIRTUAL_KEY',\n baseUrl: 'SELF_HOSTED_GATEWAY_URL'\n});\n\nasync function main() {\n const response = await portkey.chat.completions.create({\n messages: [{ role: \"system\", content: \"You are a helpful assistant.\" }],\n model: \"gpt-5\",\n max_completion_tokens: 250,\n });\n\n console.log(response.choices[0]);\n}\n\nmain();\n"}],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExampleType":"generated","prefillPlaygroundWithExample":true,"prefillPlaygroundExamples":[{"body.messages.items.0.oneOf.0.content":"\u003cstring>","body.messages.items.0.oneOf.0.role":"system","body.messages.items.0.oneOf.0.name":"\u003cstring>","body.model.oneOf.0":"gpt-5","body.frequency_penalty.oneOf.0":0,"body.logprobs.oneOf.0":false,"body.top_logprobs.oneOf.0":10,"body.max_tokens.oneOf.0":123,"body.max_completion_tokens.oneOf.0":123,"body.n.oneOf.0":1,"body.presence_penalty.oneOf.0":0,"body.response_format.oneOf.0.type":"text","body.seed.oneOf.0":0,"body.stop.oneOf.0":"\u003cstring>","body.stream.oneOf.0":false,"body.thinking.oneOf.0.type":"enabled","body.thinking.oneOf.0.budget_tokens":2030,"body.temperature.oneOf.0":1,"body.top_p.oneOf.0":1,"body.tools.items.0.type":"function","body.tools.items.0.function.name":"\u003cstring>","body.tools.items.0.function.description":"\u003cstring>","body.tools.items.0.function.parameters":{},"body.tools.items.0.function.strict.oneOf.0":false,"body.parallel_tool_calls":true,"body.user":"user-1234","body.functions.items.0.name":"\u003cstring>","body.functions.items.0.description":"\u003cstring>","body.functions.items.0.parameters":{}}],"urlDisplay":"full"},"dependencies":{"parameters":{"c6a71233-d439-47aa-9456-6fee06d77595":{"in":"header","name":"x-portkey-trace-id","schema":{"type":"string","isRequired":false,"description":"An ID you can pass to refer to one or more requests later on. If not provided, Portkey generates a trace ID automatically for each request. [Docs](https://portkey.ai/docs/product/observability/traces)","uniqueKey":"","typeLabel":"string"},"description":"An ID you can pass to refer to one or more requests later on. If not provided, Portkey generates a trace ID automatically for each request. [Docs](https://portkey.ai/docs/product/observability/traces)","required":false},"59bad3d3-ad5a-4eaa-a39a-03a3431a83e4":{"in":"header","name":"x-portkey-span-id","schema":{"type":"string","isRequired":false,"description":"An ID you can pass to refer to a span under a trace.","uniqueKey":"","typeLabel":"string"},"description":"An ID you can pass to refer to a span under a trace.","required":false},"b2baeb62-8781-429a-883f-def835435b31":{"in":"header","name":"x-portkey-parent-span-id","schema":{"type":"string","isRequired":false,"description":"Link a child span to a parent span","uniqueKey":"","typeLabel":"string"},"description":"Link a child span to a parent span","required":false},"a9838c94-0d4d-4478-af96-e22d3a441613":{"in":"header","name":"x-portkey-span-name","schema":{"type":"string","isRequired":false,"description":"Name for the Span ID","uniqueKey":"","typeLabel":"string"},"description":"Name for the Span ID","required":false},"8f882219-cf47-432c-98fb-33fd6fa17b64":{"in":"header","name":"x-portkey-metadata","schema":{"type":"object","isRequired":false,"description":"Pass any arbitrary metadata along with your request","uniqueKey":"","typeLabel":"object"},"description":"Pass any arbitrary metadata along with your request","required":false},"17297681-c47d-4001-a1ec-7bcb5dfe6256":{"in":"header","name":"x-portkey-cache-namespace","schema":{"type":"string","description":"Partition your Portkey cache store based on custom strings, ignoring metadata and other headers","uniqueKey":"","typeLabel":"string"},"description":"Partition your Portkey cache store based on custom strings, ignoring metadata and other headers"},"a286be96-37d9-4eb5-9ba4-2ba8c414dba4":{"in":"header","name":"x-portkey-cache-force-refresh","schema":{"type":"boolean","description":"Forces a cache refresh for your request by making a new API call and storing the updated value","uniqueKey":"","typeLabel":"boolean"},"description":"Forces a cache refresh for your request by making a new API call and storing the updated value"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"description":"A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).","type":"array","minItems":1,"items":{"oneOf":[{"type":"object","title":"System message","required":["content","role"],"x-oaiExpandable":true,"properties":{"content":{"description":"The contents of the system message.","type":"string","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.0.content","typeLabel":"string"},"role":{"type":"string","enum":["system"],"description":"The role of the messages author, in this case `system`.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.0.role","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role.","uniqueKey":"messages.items.[INDEX].oneOf.0.name","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].oneOf.0","typeLabel":"System message · object"},{"type":"object","title":"Developer message","description":"New role by OpenAI for select models. Must be explicitly used for models that support it. When used with incompatible models or providers, Portkey automatically converts it to a system role.","required":["content","role"],"x-oaiExpandable":true,"properties":{"content":{"description":"The contents of the Developer message.","type":"string","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.1.content","typeLabel":"string"},"role":{"type":"string","enum":["developer"],"description":"The role of the messages author, in this case `Developer`.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.1.role","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role.","uniqueKey":"messages.items.[INDEX].oneOf.1.name","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].oneOf.1","typeLabel":"Developer message · object"},{"type":"object","title":"User message","required":["content","role"],"x-oaiExpandable":true,"properties":{"content":{"oneOf":[{"type":"string","title":"Text content","description":"The contents of the user message.\n","x-oaiExpandable":true,"isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.0","typeLabel":"string"},{"type":"array","items":{"oneOf":[{"type":"object","title":"Text content part","required":["type","text"],"x-oaiExpandable":true,"properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","description":"The text content.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.0","typeLabel":"Text content part · object"},{"type":"object","title":"Image content part","required":["type","image_url"],"x-oaiExpandable":true,"properties":{"type":{"type":"string","enum":["image_url"],"description":"The type of the content part.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"object","properties":{"url":{"type":"string","description":"Either a URL of the image or the base64 encoded image data.","format":"uri","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.1.image_url.url","typeLabel":"string\u003curi>"},"detail":{"type":"string","description":"Specifies the detail level of the image. Learn more in the [Vision guide](https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding).","enum":["auto","low","high"],"default":"auto","uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.1.image_url.detail","typeLabel":"enum\u003cstring>"}},"required":["url"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.1.image_url","typeLabel":"object"}},"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX].oneOf.1","typeLabel":"Image content part · object"}],"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1.items.[INDEX]","typeLabel":"Text content part · object | Image content part · object"},"title":"Array of content parts","description":"The contents of the user message.\n","minItems":1,"x-oaiExpandable":true,"isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content.oneOf.1","typeLabel":"(Text content part · object | Image content part · object)[]"}],"isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.content","typeLabel":"string | (Text content part · object | Image content part · object)[]"},"role":{"type":"string","enum":["user"],"description":"The role of the messages author, in this case `user`.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.2.role","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role.","uniqueKey":"messages.items.[INDEX].oneOf.2.name","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].oneOf.2","typeLabel":"User message · object"},{"type":"object","title":"Assistant message","required":["role"],"x-oaiExpandable":true,"properties":{"role":{"type":"string","enum":["assistant"],"description":"The role of the messages author, in this case `assistant`.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.role","typeLabel":"enum\u003cstring>"},"content":{"oneOf":[{"type":"string","description":"The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n","uniqueKey":"messages.items.[INDEX].oneOf.3.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n","uniqueKey":"messages.items.[INDEX].oneOf.3.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].oneOf.3.content","typeLabel":"string | null"},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role.","uniqueKey":"messages.items.[INDEX].oneOf.3.name","typeLabel":"string"},"tool_calls":{"type":"array","description":"The tool calls generated by the model, such as function calls.","items":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only `function` is supported.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","description":"The function that the model called.","properties":{"name":{"type":"string","description":"The name of the function to call.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"required":["name","arguments"],"isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.tool_calls.items.[INDEX].function","typeLabel":"object"}},"required":["id","type","function"],"uniqueKey":"messages.items.[INDEX].oneOf.3.tool_calls.items.[INDEX]","typeLabel":"object"},"uniqueKey":"messages.items.[INDEX].oneOf.3.tool_calls","typeLabel":"object[]"},"function_call":{"oneOf":[{"type":"object","deprecated":true,"description":"Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.","properties":{"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.function_call.oneOf.0.arguments","typeLabel":"string"},"name":{"type":"string","description":"The name of the function to call.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.3.function_call.oneOf.0.name","typeLabel":"string"}},"required":["arguments","name"],"uniqueKey":"messages.items.[INDEX].oneOf.3.function_call.oneOf.0","typeLabel":"object"},{"type":"null","deprecated":true,"description":"Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.","properties":{"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."},"name":{"type":"string","description":"The name of the function to call."}},"required":["arguments","name"],"uniqueKey":"messages.items.[INDEX].oneOf.3.function_call.oneOf.1","typeLabel":"null"}],"uniqueKey":"messages.items.[INDEX].oneOf.3.function_call","typeLabel":"object | null"}},"uniqueKey":"messages.items.[INDEX].oneOf.3","typeLabel":"Assistant message · object"},{"type":"object","title":"Tool message","required":["role","content","tool_call_id"],"x-oaiExpandable":true,"properties":{"role":{"type":"string","enum":["tool"],"description":"The role of the messages author, in this case `tool`.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.4.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"The contents of the tool message.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.4.content","typeLabel":"string"},"tool_call_id":{"type":"string","description":"Tool call that this message is responding to.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.4.tool_call_id","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].oneOf.4","typeLabel":"Tool message · object"},{"type":"object","title":"Function message","required":["role","content","name"],"deprecated":true,"x-oaiExpandable":true,"properties":{"role":{"type":"string","enum":["function"],"description":"The role of the messages author, in this case `function`.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.5.role","typeLabel":"enum\u003cstring>"},"content":{"oneOf":[{"type":"string","description":"The contents of the function message.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.5.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"The contents of the function message.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.5.content.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.5.content","typeLabel":"string | null"},"name":{"type":"string","description":"The name of the function to call.","isRequired":true,"uniqueKey":"messages.items.[INDEX].oneOf.5.name","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX].oneOf.5","typeLabel":"Function message · object"}],"uniqueKey":"messages.items.[INDEX]","typeLabel":"System message · object | Developer message · object | User message · object | Assistant message · object | Tool message · object | Function message · object"},"isRequired":true,"uniqueKey":"messages","typeLabel":"(System message · object | Developer message · object | User message · object | Assistant message · object | Tool message · object | Function message · object)[]"},"model":{"oneOf":[{"type":"string","description":"ID of the model to use. See the [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API.","x-oaiTypeLabel":"string","example":"gpt-5","isRequired":true,"uniqueKey":"model.oneOf.0","typeLabel":"string"},{"type":"string","description":"ID of the model to use. See the [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API.","enum":["gpt-5","gpt-5-mini","gpt-5-nano","o4-mini","o3","o3-mini","o1","o1-mini","gpt-4o","gpt-4o-mini","gpt-4o-2024-05-13","gpt-4-turbo","gpt-4-turbo-2024-04-09","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4","gpt-4-0314","gpt-4-0613","gpt-4-32k","gpt-4-32k-0314","gpt-4-32k-0613","gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-3.5-turbo-0301","gpt-3.5-turbo-0613","gpt-3.5-turbo-1106","gpt-3.5-turbo-0125","gpt-3.5-turbo-16k-0613"],"x-oaiTypeLabel":"string","example":"gpt-5","isRequired":true,"uniqueKey":"model.oneOf.1","typeLabel":"enum\u003cstring>"}],"isRequired":true,"uniqueKey":"model","typeLabel":"string | enum\u003cstring>"},"frequency_penalty":{"oneOf":[{"type":"number","default":0,"minimum":-2,"maximum":2,"description":"Number 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.\n\n[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)\n","uniqueKey":"frequency_penalty.oneOf.0","typeLabel":"number"},{"type":"null","default":0,"minimum":-2,"maximum":2,"description":"Number 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.\n\n[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)\n","uniqueKey":"frequency_penalty.oneOf.1","typeLabel":"null"}],"uniqueKey":"frequency_penalty","typeLabel":"number | null"},"logit_bias":{"oneOf":[{"type":"object","x-oaiTypeLabel":"map","default":null,"additionalProperties":{"type":"integer","uniqueKey":"logit_bias.oneOf.0.additionalProperties","typeLabel":"integer"},"description":"Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts 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.\n","uniqueKey":"logit_bias.oneOf.0","typeLabel":"object"},{"type":"null","x-oaiTypeLabel":"map","default":null,"additionalProperties":{"type":"integer","uniqueKey":"logit_bias.oneOf.1.additionalProperties","typeLabel":"integer"},"description":"Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts 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.\n","uniqueKey":"logit_bias.oneOf.1","typeLabel":"null"}],"uniqueKey":"logit_bias","typeLabel":"object | null"},"logprobs":{"oneOf":[{"description":"Whether 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`.","type":"boolean","default":false,"uniqueKey":"logprobs.oneOf.0","typeLabel":"boolean"},{"description":"Whether 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`.","type":"null","default":false,"uniqueKey":"logprobs.oneOf.1","typeLabel":"null"}],"uniqueKey":"logprobs","typeLabel":"boolean | null"},"top_logprobs":{"oneOf":[{"description":"An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.","type":"integer","minimum":0,"maximum":20,"uniqueKey":"top_logprobs.oneOf.0","typeLabel":"integer"},{"description":"An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.","type":"null","minimum":0,"maximum":20,"uniqueKey":"top_logprobs.oneOf.1","typeLabel":"null"}],"uniqueKey":"top_logprobs","typeLabel":"integer | null"},"max_tokens":{"oneOf":[{"description":"Deprecated in favor of `max_completion_tokens`.\n\nThe maximum number of [tokens](https://platform.openai.com/tokenizer?view=bpe) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API.\n\n**Supported models:** GPT-4o, GPT-4o-mini, GPT-4, GPT-4 Turbo, GPT-3.5 Turbo.\n\n**Not supported:** o-series reasoning models (o1, o3, o3-mini, o4-mini) and GPT-5 series — use `max_completion_tokens` instead.\n","type":"integer","deprecated":true,"uniqueKey":"max_tokens.oneOf.0","typeLabel":"integer"},{"description":"Deprecated in favor of `max_completion_tokens`.\n\nThe maximum number of [tokens](https://platform.openai.com/tokenizer?view=bpe) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API.\n\n**Supported models:** GPT-4o, GPT-4o-mini, GPT-4, GPT-4 Turbo, GPT-3.5 Turbo.\n\n**Not supported:** o-series reasoning models (o1, o3, o3-mini, o4-mini) and GPT-5 series — use `max_completion_tokens` instead.\n","type":"null","deprecated":true,"uniqueKey":"max_tokens.oneOf.1","typeLabel":"null"}],"uniqueKey":"max_tokens","typeLabel":"integer | null"},"max_completion_tokens":{"oneOf":[{"description":"An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\n\n**Supported models:** GPT-5 series, o-series reasoning models (o1, o3, o3-mini, o4-mini) — required. Also supported on GPT-4o, GPT-4o-mini, GPT-4, GPT-4 Turbo, GPT-3.5 Turbo as a replacement for `max_tokens`.\n","type":"integer","uniqueKey":"max_completion_tokens.oneOf.0","typeLabel":"integer"},{"description":"An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\n\n**Supported models:** GPT-5 series, o-series reasoning models (o1, o3, o3-mini, o4-mini) — required. Also supported on GPT-4o, GPT-4o-mini, GPT-4, GPT-4 Turbo, GPT-3.5 Turbo as a replacement for `max_tokens`.\n","type":"null","uniqueKey":"max_completion_tokens.oneOf.1","typeLabel":"null"}],"uniqueKey":"max_completion_tokens","typeLabel":"integer | null"},"n":{"oneOf":[{"type":"integer","minimum":1,"maximum":128,"default":1,"example":1,"description":"How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.","uniqueKey":"n.oneOf.0","typeLabel":"integer"},{"type":"null","minimum":1,"maximum":128,"default":1,"example":1,"description":"How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.","uniqueKey":"n.oneOf.1","typeLabel":"null"}],"uniqueKey":"n","typeLabel":"integer | null"},"presence_penalty":{"oneOf":[{"type":"number","default":0,"minimum":-2,"maximum":2,"description":"Number 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.\n\n[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)\n","uniqueKey":"presence_penalty.oneOf.0","typeLabel":"number"},{"type":"null","default":0,"minimum":-2,"maximum":2,"description":"Number 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.\n\n[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)\n","uniqueKey":"presence_penalty.oneOf.1","typeLabel":"null"}],"uniqueKey":"presence_penalty","typeLabel":"number | null"},"response_format":{"oneOf":[{"type":"object","title":"Text","description":"Default response format. Used to generate text responses.\n","required":["type"],"properties":{"type":{"type":"string","description":"The type of response format being defined. Always `text`.","enum":["text"],"x-stainless-const":true,"isRequired":true,"uniqueKey":"response_format.oneOf.0.type","typeLabel":"enum\u003cstring>"}},"uniqueKey":"response_format.oneOf.0","typeLabel":"Text · object"},{"type":"object","title":"JSON schema","description":"JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](/docs/guides/structured-outputs).\n","required":["type","json_schema"],"properties":{"type":{"type":"string","description":"The type of response format being defined. Always `json_schema`.","enum":["json_schema"],"x-stainless-const":true,"isRequired":true,"uniqueKey":"response_format.oneOf.1.type","typeLabel":"enum\u003cstring>"},"json_schema":{"type":"object","title":"JSON schema","description":"Structured Outputs configuration options, including a JSON Schema.\n","properties":{"name":{"type":"string","description":"The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n","isRequired":true,"uniqueKey":"response_format.oneOf.1.json_schema.name","typeLabel":"string"},"description":{"type":"string","description":"A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n","uniqueKey":"response_format.oneOf.1.json_schema.description","typeLabel":"string"},"schema":{"type":"object","title":"JSON schema","description":"The schema for the response format, described as a JSON Schema object.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n","additionalProperties":true,"uniqueKey":"response_format.oneOf.1.json_schema.schema","typeLabel":"JSON schema · object"},"strict":{"oneOf":[{"type":"boolean","default":false,"description":"Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n","uniqueKey":"response_format.oneOf.1.json_schema.strict.oneOf.0","typeLabel":"boolean"},{"type":"null","default":false,"description":"Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n","uniqueKey":"response_format.oneOf.1.json_schema.strict.oneOf.1","typeLabel":"null"}],"uniqueKey":"response_format.oneOf.1.json_schema.strict","typeLabel":"boolean | null"}},"required":["name"],"isRequired":true,"uniqueKey":"response_format.oneOf.1.json_schema","typeLabel":"JSON schema · object"}},"uniqueKey":"response_format.oneOf.1","typeLabel":"JSON schema · object"},{"type":"object","title":"JSON object","description":"JSON object response format. An older method of generating JSON responses.\nUsing `json_schema` is recommended for models that support it. Note that the\nmodel will not generate JSON without a system or user message instructing it\nto do so.\n","required":["type"],"properties":{"type":{"type":"string","description":"The type of response format being defined. Always `json_object`.","enum":["json_object"],"x-stainless-const":true,"isRequired":true,"uniqueKey":"response_format.oneOf.2.type","typeLabel":"enum\u003cstring>"}},"uniqueKey":"response_format.oneOf.2","typeLabel":"JSON object · object"}],"uniqueKey":"response_format","typeLabel":"Text · object | JSON schema · object | JSON object · object"},"seed":{"oneOf":[{"type":"integer","minimum":-9223372036854776000,"maximum":9223372036854776000,"description":"This feature is in Beta.\nIf 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.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n","x-code-samples":{"beta":true},"uniqueKey":"seed.oneOf.0","typeLabel":"integer"},{"type":"null","minimum":-9223372036854776000,"maximum":9223372036854776000,"description":"This feature is in Beta.\nIf 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.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n","x-code-samples":{"beta":true},"uniqueKey":"seed.oneOf.1","typeLabel":"null"}],"uniqueKey":"seed","typeLabel":"integer | null"},"stop":{"oneOf":[{"type":"string","description":"Up to 4 sequences where the API will stop generating further tokens.\n","uniqueKey":"stop.oneOf.0","typeLabel":"string"},{"type":"null","description":"Up to 4 sequences where the API will stop generating further tokens.\n","uniqueKey":"stop.oneOf.1","typeLabel":"null"},{"type":"array","items":{"type":"string","uniqueKey":"stop.oneOf.2.items.[INDEX]","typeLabel":"string"},"description":"Up to 4 sequences where the API will stop generating further tokens.\n","maxItems":4,"minItems":1,"uniqueKey":"stop.oneOf.2","typeLabel":"string[]"}],"uniqueKey":"stop","typeLabel":"string | null | string[]"},"stream":{"oneOf":[{"description":"If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-UShttps://platform.openai.com/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n","type":"boolean","default":false,"uniqueKey":"stream.oneOf.0","typeLabel":"boolean"},{"description":"If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-UShttps://platform.openai.com/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n","type":"null","default":false,"uniqueKey":"stream.oneOf.1","typeLabel":"null"}],"uniqueKey":"stream","typeLabel":"boolean | null"},"stream_options":{"oneOf":[{"description":"Options for streaming response. Only set this when you set `stream: true`.\n","type":"object","default":null,"properties":{"include_usage":{"type":"boolean","description":"If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.\n","uniqueKey":"stream_options.oneOf.0.include_usage","typeLabel":"boolean"}},"uniqueKey":"stream_options.oneOf.0","typeLabel":"object"},{"description":"Options for streaming response. Only set this when you set `stream: true`.\n","type":"null","default":null,"properties":{"include_usage":{"type":"boolean","description":"If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array. All other chunks will also include a `usage` field, but with a null value.\n"}},"uniqueKey":"stream_options.oneOf.1","typeLabel":"null"}],"uniqueKey":"stream_options","typeLabel":"object | null"},"thinking":{"oneOf":[{"type":"object","description":"View the thinking/reasoning tokens as part of your response. Thinking models produce a long internal chain of thought before generating a response. Supported only for specific Claude models on Anthropic, Google Vertex AI, and AWS Bedrock. Requires setting `strict_openai_compliance = false` in your API call.\n","properties":{"type":{"type":"string","enum":["enabled","disabled"],"description":"Enables or disables the thinking mode capability.","default":"disabled","isRequired":true,"uniqueKey":"thinking.oneOf.0.type","typeLabel":"enum\u003cstring>"},"budget_tokens":{"type":"integer","description":"The maximum number of tokens to allocate for the thinking process.\nA higher token budget allows for more thorough reasoning but may increase overall response time.\n","minimum":1,"example":2030,"uniqueKey":"thinking.oneOf.0.budget_tokens","typeLabel":"integer"}},"required":["type"],"example":{"type":"enabled","budget_tokens":2030},"uniqueKey":"thinking.oneOf.0","typeLabel":"object"},{"type":"null","description":"View the thinking/reasoning tokens as part of your response. Thinking models produce a long internal chain of thought before generating a response. Supported only for specific Claude models on Anthropic, Google Vertex AI, and AWS Bedrock. Requires setting `strict_openai_compliance = false` in your API call.\n","properties":{"type":{"type":"string","enum":["enabled","disabled"],"description":"Enables or disables the thinking mode capability.","default":"disabled"},"budget_tokens":{"type":"integer","description":"The maximum number of tokens to allocate for the thinking process.\nA higher token budget allows for more thorough reasoning but may increase overall response time.\n","minimum":1,"example":2030}},"required":["type"],"example":{"type":"enabled","budget_tokens":2030},"uniqueKey":"thinking.oneOf.1","typeLabel":"null"}],"uniqueKey":"thinking","typeLabel":"object | null"},"temperature":{"oneOf":[{"type":"number","minimum":0,"maximum":2,"default":1,"example":1,"description":"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n","uniqueKey":"temperature.oneOf.0","typeLabel":"number"},{"type":"null","minimum":0,"maximum":2,"default":1,"example":1,"description":"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n","uniqueKey":"temperature.oneOf.1","typeLabel":"null"}],"uniqueKey":"temperature","typeLabel":"number | null"},"top_p":{"oneOf":[{"type":"number","minimum":0,"maximum":1,"default":1,"example":1,"description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n","uniqueKey":"top_p.oneOf.0","typeLabel":"number"},{"type":"null","minimum":0,"maximum":1,"default":1,"example":1,"description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n","uniqueKey":"top_p.oneOf.1","typeLabel":"null"}],"uniqueKey":"top_p","typeLabel":"number | null"},"tools":{"type":"array","description":"A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n","items":{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only `function` is supported.","isRequired":true,"uniqueKey":"tools.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.","isRequired":true,"uniqueKey":"tools.items.[INDEX].function.name","typeLabel":"string"},"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function.","uniqueKey":"tools.items.[INDEX].function.description","typeLabel":"string"},"parameters":{"type":"object","description":"The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list.","additionalProperties":true,"uniqueKey":"tools.items.[INDEX].function.parameters","typeLabel":"object"},"strict":{"oneOf":[{"type":"boolean","default":false,"description":"Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).","uniqueKey":"tools.items.[INDEX].function.strict.oneOf.0","typeLabel":"boolean"},{"type":"null","default":false,"description":"Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling).","uniqueKey":"tools.items.[INDEX].function.strict.oneOf.1","typeLabel":"null"}],"uniqueKey":"tools.items.[INDEX].function.strict","typeLabel":"boolean | null"}},"required":["name"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].function","typeLabel":"object"}},"required":["type","function"],"uniqueKey":"tools.items.[INDEX]","typeLabel":"object"},"uniqueKey":"tools","typeLabel":"object[]"},"tool_choice":{"oneOf":[{"type":"string","description":"Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n","enum":["none","auto","required"],"x-oaiExpandable":true,"uniqueKey":"tool_choice.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"object","description":"Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n","required":["type","function"],"x-oaiExpandable":true,"properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only `function` is supported.","isRequired":true,"uniqueKey":"tool_choice.oneOf.1.type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call.","isRequired":true,"uniqueKey":"tool_choice.oneOf.1.function.name","typeLabel":"string"}},"required":["name"],"isRequired":true,"uniqueKey":"tool_choice.oneOf.1.function","typeLabel":"object"}},"uniqueKey":"tool_choice.oneOf.1","typeLabel":"object"}],"uniqueKey":"tool_choice","typeLabel":"enum\u003cstring> | object"},"parallel_tool_calls":{"description":"Whether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling) during tool use.","type":"boolean","default":true,"uniqueKey":"parallel_tool_calls","typeLabel":"boolean"},"user":{"type":"string","example":"user-1234","description":"A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).\n","uniqueKey":"user","typeLabel":"string"},"function_call":{"oneOf":[{"type":"string","description":"Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n`none` means the model will not call a function and instead generates a message.\n`auto` means the model can pick between generating a message or calling a function.\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n\n`none` is the default when no functions are present. `auto` is the default if functions are present.\n","enum":["none","auto"],"deprecated":true,"x-oaiExpandable":true,"uniqueKey":"function_call.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"object","description":"Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n`none` means the model will not call a function and instead generates a message.\n`auto` means the model can pick between generating a message or calling a function.\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n\n`none` is the default when no functions are present. `auto` is the default if functions are present.\n","required":["name"],"deprecated":true,"x-oaiExpandable":true,"properties":{"name":{"type":"string","description":"The name of the function to call.","isRequired":true,"uniqueKey":"function_call.oneOf.1.name","typeLabel":"string"}},"uniqueKey":"function_call.oneOf.1","typeLabel":"object"}],"uniqueKey":"function_call","typeLabel":"enum\u003cstring> | object"},"functions":{"deprecated":true,"description":"Deprecated in favor of `tools`.\n\nA list of functions the model may generate JSON inputs for.\n","type":"array","minItems":1,"maxItems":128,"items":{"type":"object","deprecated":true,"properties":{"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.","isRequired":true,"uniqueKey":"functions.items.[INDEX].name","typeLabel":"string"},"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function.","uniqueKey":"functions.items.[INDEX].description","typeLabel":"string"},"parameters":{"type":"object","description":"The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list.","additionalProperties":true,"uniqueKey":"functions.items.[INDEX].parameters","typeLabel":"object"}},"required":["name"],"uniqueKey":"functions.items.[INDEX]","typeLabel":"object"},"uniqueKey":"functions","typeLabel":"object[]"}},"required":["model","messages"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"messages":[{"content":"\u003cstring>","role":"system","name":"\u003cstring>"}],"model":"gpt-5","frequency_penalty":0,"logit_bias":null,"logprobs":false,"top_logprobs":10,"max_tokens":123,"max_completion_tokens":123,"n":1,"presence_penalty":0,"response_format":{"type":"text"},"seed":0,"stop":"\u003cstring>","stream":false,"stream_options":null,"thinking":{"type":"enabled","budget_tokens":2030},"temperature":1,"top_p":1,"tools":[{"type":"function","function":{"name":"\u003cstring>","description":"\u003cstring>","parameters":{},"strict":false}}],"parallel_tool_calls":true,"user":"user-1234","functions":[{"name":"\u003cstring>","description":"\u003cstring>","parameters":{}}]}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"f71fb723-0393-486d-b456-ea439761d280":{"description":"OK","content":{"application/json":{"schema":{"type":"object","description":"Represents a chat completion response returned by model, based on the provided input.","properties":{"id":{"type":"string","description":"A unique identifier for the chat completion.","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"choices":{"type":"array","description":"A list of chat completion choices. Can be more than one if `n` is greater than 1.","items":{"type":"object","required":["finish_reason","index","message","logprobs"],"properties":{"finish_reason":{"type":"string","description":"The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n","enum":["stop","length","tool_calls","content_filter","function_call"],"isRequired":true,"uniqueKey":"choices.items.[INDEX].finish_reason","typeLabel":"enum\u003cstring>"},"index":{"type":"integer","description":"The index of the choice in the list of choices.","isRequired":true,"uniqueKey":"choices.items.[INDEX].index","typeLabel":"integer"},"message":{"type":"object","description":"A chat completion message generated by the model.","properties":{"content":{"oneOf":[{"type":"string","description":"The contents of the message.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"The contents of the message.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content","typeLabel":"string | null"},"role":{"type":"string","enum":["assistant"],"description":"The role of the author of this message.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.role","typeLabel":"enum\u003cstring>"},"tool_calls":{"type":"array","description":"The tool calls generated by the model, such as function calls.","items":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only `function` is supported.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","description":"The function that the model called.","properties":{"name":{"type":"string","description":"The name of the function to call.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"required":["name","arguments"],"isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function","typeLabel":"object"}},"required":["id","type","function"],"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX]","typeLabel":"object"},"uniqueKey":"choices.items.[INDEX].message.tool_calls","typeLabel":"object[]"},"function_call":{"type":"object","deprecated":true,"description":"Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.","properties":{"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.function_call.arguments","typeLabel":"string"},"name":{"type":"string","description":"The name of the function to call.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.function_call.name","typeLabel":"string"}},"required":["name","arguments"],"uniqueKey":"choices.items.[INDEX].message.function_call","typeLabel":"object"},"content_blocks":{"oneOf":[{"type":"array","description":"The content blocks of the message. This is only present for certain providers with strict-open-ai-compliance flag set to false","items":{"oneOf":[{"type":"object","title":"Text content part","description":"A block of content in a chat completion message.","required":["type","text"],"properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","description":"The text content.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.0","typeLabel":"Text content part · object"},{"type":"object","title":"Thinking content part","description":"A block of content in a chat completion message.","required":["type","thinking"],"properties":{"type":{"type":"string","enum":["thinking"],"description":"The type of the content part.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"thinking":{"type":"string","description":"The thinking content.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.1.thinking","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.1","typeLabel":"Thinking content part · object"},{"type":"object","title":"Redacted thinking content part","description":"A block of content in a chat completion message.","required":["type","data"],"properties":{"type":{"type":"string","enum":["redacted_thinking"],"description":"The type of the content part.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"data":{"type":"string","description":"The redacted thinking content.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.2.data","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX].oneOf.2","typeLabel":"Redacted thinking content part · object"}],"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0.items.[INDEX]","typeLabel":"Text content part · object | Thinking content part · object | Redacted thinking content part · object"},"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.0","typeLabel":"(Text content part · object | Thinking content part · object | Redacted thinking content part · object)[]"},{"type":"null","description":"The content blocks of the message. This is only present for certain providers with strict-open-ai-compliance flag set to false","items":{"oneOf":[{"type":"object","title":"Text content part","description":"A block of content in a chat completion message.","required":["type","text"],"properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}}},{"type":"object","title":"Thinking content part","description":"A block of content in a chat completion message.","required":["type","thinking"],"properties":{"type":{"type":"string","enum":["thinking"],"description":"The type of the content part."},"thinking":{"type":"string","description":"The thinking content."}}},{"type":"object","title":"Redacted thinking content part","description":"A block of content in a chat completion message.","required":["type","data"],"properties":{"type":{"type":"string","enum":["redacted_thinking"],"description":"The type of the content part."},"data":{"type":"string","description":"The redacted thinking content."}}}]},"uniqueKey":"choices.items.[INDEX].message.content_blocks.oneOf.1","typeLabel":"null"}],"uniqueKey":"choices.items.[INDEX].message.content_blocks","typeLabel":"(Text content part · object | Thinking content part · object | Redacted thinking content part · object)[] | null"}},"required":["role","content"],"isRequired":true,"uniqueKey":"choices.items.[INDEX].message","typeLabel":"object"},"logprobs":{"oneOf":[{"description":"Log probability information for the choice.","type":"object","properties":{"content":{"oneOf":[{"description":"A list of message content tokens with log probability information.","type":"array","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].token","typeLabel":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].logprob","typeLabel":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes.oneOf.0.items.[INDEX]","typeLabel":"integer"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes.oneOf.0","typeLabel":"integer[]"},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].bytes","typeLabel":"integer[] | null"},"top_logprobs":{"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.","type":"array","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].token","typeLabel":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number","isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].logprob","typeLabel":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer","uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes.oneOf.0.items.[INDEX]","typeLabel":"integer"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes.oneOf.0","typeLabel":"integer[]"},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX].bytes","typeLabel":"integer[] | null"}},"required":["token","logprob","bytes"],"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX].top_logprobs","typeLabel":"object[]"}},"required":["token","logprob","bytes","top_logprobs"],"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.0","typeLabel":"object[]"},{"description":"A list of message content tokens with log probability information.","type":"null","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer"}},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"}}]},"top_logprobs":{"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.","type":"array","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer"}},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"}}]}},"required":["token","logprob","bytes"]}}},"required":["token","logprob","bytes","top_logprobs"]},"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0.content","typeLabel":"object[] | null"}},"required":["content"],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.0","typeLabel":"object"},{"description":"Log probability information for the choice.","type":"null","properties":{"content":{"oneOf":[{"description":"A list of message content tokens with log probability information.","type":"array","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer"}},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"}}]},"top_logprobs":{"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.","type":"array","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer"}},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"}}]}},"required":["token","logprob","bytes"]}}},"required":["token","logprob","bytes","top_logprobs"]}},{"description":"A list of message content tokens with log probability information.","type":"null","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer"}},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"}}]},"top_logprobs":{"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned.","type":"array","items":{"type":"object","properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.","type":"number"},"bytes":{"oneOf":[{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"array","items":{"type":"integer"}},{"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.","type":"null","items":{"type":"integer"}}]}},"required":["token","logprob","bytes"]}}},"required":["token","logprob","bytes","top_logprobs"]}}]}},"required":["content"],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"choices.items.[INDEX].logprobs","typeLabel":"object | null"}},"uniqueKey":"choices.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"choices","typeLabel":"object[]"},"created":{"type":"integer","description":"The Unix timestamp (in seconds) of when the chat completion was created.","isRequired":true,"uniqueKey":"created","typeLabel":"integer"},"model":{"type":"string","description":"The model used for the chat completion.","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"object":{"type":"string","description":"The object type, which is always `chat.completion`.","enum":["chat.completion"],"isRequired":true,"uniqueKey":"object","typeLabel":"enum\u003cstring>"},"system_fingerprint":{"type":"string","description":"This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n","uniqueKey":"system_fingerprint","typeLabel":"string"},"usage":{"type":"object","description":"Usage statistics for the completion request.","properties":{"completion_tokens":{"type":"integer","description":"Number of tokens in the generated completion.","isRequired":true,"uniqueKey":"usage.completion_tokens","typeLabel":"integer"},"prompt_tokens":{"type":"integer","description":"Number of tokens in the prompt.","isRequired":true,"uniqueKey":"usage.prompt_tokens","typeLabel":"integer"},"total_tokens":{"type":"integer","description":"Total number of tokens used in the request (prompt + completion).","isRequired":true,"uniqueKey":"usage.total_tokens","typeLabel":"integer"},"completion_tokens_details":{"oneOf":[{"type":"object","description":"Breakdown of tokens used in a completion.","properties":{"reasoning_tokens":{"type":"integer","description":"Tokens generated by the model for reasoning.","uniqueKey":"usage.completion_tokens_details.oneOf.0.reasoning_tokens","typeLabel":"integer"},"accepted_prediction_tokens":{"type":"integer","description":"When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.","uniqueKey":"usage.completion_tokens_details.oneOf.0.accepted_prediction_tokens","typeLabel":"integer"},"rejected_prediction_tokens":{"type":"integer","description":"When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion.","uniqueKey":"usage.completion_tokens_details.oneOf.0.rejected_prediction_tokens","typeLabel":"integer"}},"uniqueKey":"usage.completion_tokens_details.oneOf.0","typeLabel":"object"},{"type":"null","description":"Breakdown of tokens used in a completion.","properties":{"reasoning_tokens":{"type":"integer","description":"Tokens generated by the model for reasoning."},"accepted_prediction_tokens":{"type":"integer","description":"When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion."},"rejected_prediction_tokens":{"type":"integer","description":"When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion."}},"uniqueKey":"usage.completion_tokens_details.oneOf.1","typeLabel":"null"}],"uniqueKey":"usage.completion_tokens_details","typeLabel":"object | null"},"prompt_tokens_details":{"oneOf":[{"type":"object","description":"Breakdown of tokens used in the prompt.","properties":{"cached_tokens":{"type":"integer","description":"Cached tokens present in the prompt.","uniqueKey":"usage.prompt_tokens_details.oneOf.0.cached_tokens","typeLabel":"integer"}},"uniqueKey":"usage.prompt_tokens_details.oneOf.0","typeLabel":"object"},{"type":"null","description":"Breakdown of tokens used in the prompt.","properties":{"cached_tokens":{"type":"integer","description":"Cached tokens present in the prompt."}},"uniqueKey":"usage.prompt_tokens_details.oneOf.1","typeLabel":"null"}],"uniqueKey":"usage.prompt_tokens_details","typeLabel":"object | null"}},"required":["prompt_tokens","completion_tokens","total_tokens"],"uniqueKey":"usage","typeLabel":"object"}},"required":["choices","created","id","model","object"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"\u003cstring>","choices":[{"finish_reason":"stop","index":123,"message":{"content":"\u003cstring>","role":"assistant","tool_calls":[{"id":"\u003cstring>","type":"function","function":{"name":"\u003cstring>","arguments":"\u003cstring>"}}],"function_call":{"arguments":"\u003cstring>","name":"\u003cstring>"},"content_blocks":[{"type":"text","text":"\u003cstring>"}]},"logprobs":{"content":[{"token":"\u003cstring>","logprob":123,"bytes":[123],"top_logprobs":[{"token":"\u003cstring>","logprob":123,"bytes":[123]}]}]}}],"created":123,"model":"\u003cstring>","object":"chat.completion","system_fingerprint":"\u003cstring>","usage":{"completion_tokens":123,"prompt_tokens":123,"total_tokens":123,"completion_tokens_details":{"reasoning_tokens":123,"accepted_prediction_tokens":123,"rejected_prediction_tokens":123},"prompt_tokens_details":{"cached_tokens":123}}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"18c99ab0-4523-4ce1-99b8-c3e8981a63ff":{"Portkey-Key":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"Virtual-Key":{"type":"apiKey","in":"header","name":"x-portkey-virtual-key","scopes":[],"schemeName":"Virtual-Key"}},"c6d17183-3e07-435b-8177-4d17999eefa2":{"Portkey-Key":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"Provider-Auth":{"type":"http","scheme":"bearer","scopes":[],"schemeName":"Provider-Auth"},"Provider-Name":{"type":"apiKey","in":"header","name":"x-portkey-provider","scopes":[],"schemeName":"Provider-Name"}},"35f52312-a38c-499c-ade5-1bc03cfb18fb":{"Portkey-Key":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"Config":{"type":"apiKey","in":"header","name":"x-portkey-config","scopes":[],"schemeName":"Config"}},"606e28de-2f31-4ea4-a031-04c5a1eccc37":{"Portkey-Key":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"Provider-Auth":{"type":"http","scheme":"bearer","scopes":[],"schemeName":"Provider-Auth"},"Provider-Name":{"type":"apiKey","in":"header","name":"x-portkey-provider","scopes":[],"schemeName":"Provider-Name"},"Custom-Host":{"type":"apiKey","in":"header","name":"x-portkey-custom-host","scopes":[],"schemeName":"Custom-Host"}}},"servers":{"6b105cf4-7388-4de1-879b-d584706b8eb7":{"url":"https://api.portkey.ai/v1","description":"Portkey API Public Endpoint"},"b96d32e1-039c-450a-9fa6-db0711977e64":{"url":"SELF_HOSTED_GATEWAY_URL","description":"Self-Hosted Gateway URL"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"schema":{"title":"x-portkey-api-key","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Portkey-Key","name":"x-portkey-api-key"},{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-virtual-key","scopes":[],"schemeName":"Virtual-Key"},"schema":{"title":"x-portkey-virtual-key","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Virtual-Key","name":"x-portkey-virtual-key"}],"title":"Portkey-Key \u0026 Virtual-Key"},{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"schema":{"title":"x-portkey-api-key","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Portkey-Key","name":"x-portkey-api-key"},{"scheme":{"type":"http","scheme":"bearer","scopes":[],"schemeName":"Provider-Auth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"Provider-Auth","name":"Authorization"},{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-provider","scopes":[],"schemeName":"Provider-Name"},"schema":{"title":"x-portkey-provider","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Provider-Name","name":"x-portkey-provider"}],"title":"Portkey-Key \u0026 Provider-Auth \u0026 Provider-Name"},{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"schema":{"title":"x-portkey-api-key","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Portkey-Key","name":"x-portkey-api-key"},{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-config","scopes":[],"schemeName":"Config"},"schema":{"title":"x-portkey-config","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Config","name":"x-portkey-config"}],"title":"Portkey-Key \u0026 Config"},{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-api-key","scopes":[],"schemeName":"Portkey-Key"},"schema":{"title":"x-portkey-api-key","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Portkey-Key","name":"x-portkey-api-key"},{"scheme":{"type":"http","scheme":"bearer","scopes":[],"schemeName":"Provider-Auth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"Provider-Auth","name":"Authorization"},{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-provider","scopes":[],"schemeName":"Provider-Name"},"schema":{"title":"x-portkey-provider","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Provider-Name","name":"x-portkey-provider"},{"scheme":{"type":"apiKey","in":"header","name":"x-portkey-custom-host","scopes":[],"schemeName":"Custom-Host"},"schema":{"title":"x-portkey-custom-host","type":"string","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"Custom-Host","name":"x-portkey-custom-host"}],"title":"Portkey-Key \u0026 Provider-Auth \u0026 Provider-Name \u0026 Custom-Host"}]},"originalFileLocation":"https://raw.githubusercontent.com/Portkey-AI/openapi/refs/heads/master/openapi.yaml"},"subdomain":"portkey-docs","siteName":"Portkey (Prisma AIRS AI Gateway) Docs","title":"Chat - Portkey (Prisma AIRS AI Gateway) Docs","relatedPagesConfig":{"enabled":true,"limit":5,"mode":"automatic"},"contextualStarterQuestions":[{"_id":"6aa971b50031bd0287c96533","deploymentId":"67086365a151447bf2fa5021","questionText":"What is PRISMA AIRS AI Gateway?","status":"active","generatedBy":"contextual","path":"api-reference/inference-api/chat","createdAt":"2026-09-15T16:26:29.381Z","updatedAt":"2026-09-15T16:26:29.381Z","__v":0},{"_id":"6aa971b50031bd0287c96532","deploymentId":"67086365a151447bf2fa5021","questionText":"How do I use the chat API?","status":"active","generatedBy":"contextual","path":"api-reference/inference-api/chat","createdAt":"2026-09-15T16:26:29.381Z","updatedAt":"2026-09-15T16:26:29.381Z","__v":0},{"_id":"6aa971b50031bd0287c96534","deploymentId":"67086365a151447bf2fa5021","questionText":"How do I get started with chat?","status":"active","generatedBy":"contextual","path":"api-reference/inference-api/chat","createdAt":"2026-09-15T16:26:29.381Z","updatedAt":"2026-09-15T16:26:29.381Z","__v":0}],"navMaps":{"firstHrefInVersion":{"Latest":{"href":"/api-reference/inference-api/chat","matchLevel":0},"Prisma AIRS":{"href":"/aigw/introduction/welcome","matchLevel":4},"Virtual Keys (Deprecated)":{"href":"/api-reference/inference-api/chat","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-09-15T13:55:28.723Z","gitLastModified":"2026-08-06T05:55:04.000Z","originalFileLocation":"api-reference/inference-api/chat.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Portkey (Prisma AIRS AI Gateway) Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Chat - Portkey (Prisma AIRS AI Gateway) Docs\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Portkey AI Gateway Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.portkey.ai/docs/api-reference/inference-api/chat\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://portkey-docs.mintlify.app/_mintlify/api/og/v2?division=Chat+Completions\u0026amp;title=Chat\u0026amp;theme=262137c9f2583e48984715e7\u0026amp;signature=ff1dbd4d501eac8a36325950f88cecef2eba1ed518e23e71e27e6490c15e9a5b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Chat - Portkey (Prisma AIRS AI Gateway) Docs\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://portkey-docs.mintlify.app/_mintlify/api/og/v2?division=Chat+Completions\u0026amp;title=Chat\u0026amp;theme=262137c9f2583e48984715e7\u0026amp;signature=ff1dbd4d501eac8a36325950f88cecef2eba1ed518e23e71e27e6490c15e9a5b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/portkey-docs/9Whrk-8bCE6hyGSn/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Portkey (Prisma AIRS AI Gateway) Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0891B2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.portkey.ai/docs/api-reference/inference-api/chat\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/api-reference/inference-api/chat.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.portkey.ai/#organization\",\"name\":\"Portkey (Prisma AIRS AI Gateway) Docs\",\"url\":\"https://docs.portkey.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/portkey-docs/tHk-hgNjLbEj4dhh/images/portkey-PANW-company-logo-positive.png?fit=max\u0026auto=format\u0026n=tHk-hgNjLbEj4dhh\u0026q=85\u0026s=c5fb09014ff79616583b1d3bffe27450\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.portkey.ai/docs#website\",\"name\":\"Portkey (Prisma AIRS AI Gateway) Docs\",\"url\":\"https://docs.portkey.ai/docs\",\"publisher\":{\"@id\":\"https://docs.portkey.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat#webpage\",\"url\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat\",\"name\":\"Chat\",\"dateModified\":\"2026-08-06T05:55:04.000Z\",\"isPartOf\":{\"@id\":\"https://docs.portkey.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portkey (Prisma AIRS AI Gateway) Docs\",\"item\":\"https://docs.portkey.ai/docs\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chat\",\"item\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat#apireference\",\"headline\":\"Chat\",\"name\":\"Chat\",\"url\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat\",\"mainEntityOfPage\":{\"@id\":\"https://docs.portkey.ai/docs/api-reference/inference-api/chat#webpage\"},\"dateModified\":\"2026-08-06T05:55:04.000Z\",\"publisher\":{\"@id\":\"https://docs.portkey.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.portkey.ai/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Portkey (Prisma AIRS AI Gateway) Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Portkey (Prisma AIRS AI Gateway) Docs","nav":{"global":null,"versions":[{"version":"Latest","tabs":[{"tab":"Docs","pages":[{"title":"Docs","href":"/introduction/what-is-portkey"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/integrations/ecosystem"}]},{"tab":"Gateway APIs","groups":[{"group":"API Reference","pages":[{"title":"Introduction","href":"/api-reference/inference-api/introduction"},{"title":"Agentic Usage","href":"/api-reference/inference-api/agentic-usage"},{"title":"Supported Providers","href":"/api-reference/inference-api/supported-providers"},{"title":"Authentication","href":"/api-reference/inference-api/authentication"},{"title":"Headers","href":"/api-reference/inference-api/headers"},{"title":"Errors","href":"/api-reference/inference-api/error-codes"},{"title":"Response Schema","href":"/api-reference/inference-api/response-schema"},{"group":"More","pages":[{"title":"Gateway Config Object","href":"/api-reference/inference-api/config-object"},{"title":"OpenAPI Specification","url":"https://github.com/Portkey-AI/openapi","href":"/api-reference/inference-api/open-api-specification"}]}]},{"group":"SDK","pages":[{"title":"Supported SDKs","href":"/api-reference/sdk/list"},{"title":"Python","href":"/api-reference/sdk/python"},{"title":"Node.js","href":"/api-reference/sdk/node"},{"title":"C# (.NET)","description":"Integrate Portkey in your `.NET` app easily using the OpenAI library and get advanced monitoring, routing, and enterprise features.","href":"/api-reference/sdk/c-sharp"}]},{"group":"Chat Completions","pages":[{"title":"Chat","openapi":"post /chat/completions","href":"/api-reference/inference-api/chat"}]},{"group":"Responses","pages":[{"title":"Create a Response","openapi":"post /responses","description":"","href":"/api-reference/inference-api/responses/responses"},{"title":"Get a Response","openapi":"get /responses/{response_id}","href":"/api-reference/inference-api/responses/retrieve-response"},{"title":"Delete a Response","openapi":"delete /responses/{response_id}","href":"/api-reference/inference-api/responses/delete-response"},{"title":"List Input Items","openapi":"get /responses/{response_id}/input_items","href":"/api-reference/inference-api/responses/retrieve-inputs"}]},{"group":"Portkey Endpoints","pages":[{"title":"Prompt Completions","openapi":"post /prompts/{promptId}/completions","href":"/api-reference/inference-api/prompts/prompt-completion"},{"title":"Prompt Render","openapi":"post /prompts/{promptId}/render","href":"/api-reference/inference-api/prompts/render"},{"title":"Insert a Log","openapi":"post /logs","href":"/api-reference/admin-api/data-plane/logs/insert-a-log"},{"title":"Create Feedback","openapi":"post /feedback","href":"/api-reference/admin-api/data-plane/feedback/create-feedback"},{"title":"Update Feedback","openapi":"put /feedback/{id}","href":"/api-reference/admin-api/data-plane/feedback/update-feedback"},{"group":"Log Exports","pages":[{"title":"Retrieve a Log Export","openapi":"get /logs/exports/{exportId}","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/retrieve-a-log-export"},{"title":"Update a Log Export","openapi":"put /logs/exports/{exportId}","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/update-a-log-export"},{"title":"List a Log Export","openapi":"get /logs/exports","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/list-log-exports"},{"title":"Create a Log Export","openapi":"post /logs/exports","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/create-a-log-export"},{"title":"Start a Log Export","openapi":"post /logs/exports/{exportId}/start","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/start-a-log-export"},{"title":"Cancel a Log Export","openapi":"post /logs/exports/{exportId}/cancel","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/cancel-a-log-export"},{"title":"Delete a Log Export","openapi":"delete /logs/exports/{exportId}","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/delete-a-log-export"},{"title":"Download a Log Export","openapi":"get /logs/exports/{exportId}/download","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/download-a-log-export"}]}]},{"group":"Embeddings","pages":[{"title":"Embeddings","openapi":"post /embeddings","href":"/api-reference/inference-api/embeddings"}]},{"group":"Rerank","pages":[{"title":"Rerank","openapi":"post /rerank","href":"/api-reference/inference-api/rerank"}]},{"group":"Decisions","pages":[{"title":"Decisions","openapi":"post /decisions","href":"/api-reference/inference-api/decisions"}]},{"group":"OCR","pages":[{"title":"OCR","openapi":"post /ocr","href":"/api-reference/inference-api/ocr"}]},{"group":"Images","pages":[{"title":"Create Image","openapi":"post /images/generations","href":"/api-reference/inference-api/images/create-image"},{"title":"Create Image Edit","openapi":"post /images/edits","href":"/api-reference/inference-api/images/create-image-edit"},{"title":"Create Image Variation","openapi":"post /images/variations","href":"/api-reference/inference-api/images/create-image-variation"}]},{"group":"Models","pages":[{"title":"Models","openapi":"get /models","href":"/api-reference/inference-api/models/models"}]},{"group":"Audio","pages":[{"title":"Create Speech","openapi":"post /audio/speech","href":"/api-reference/inference-api/audio/create-speech"},{"title":"Create Transcription","openapi":"post /audio/transcriptions","href":"/api-reference/inference-api/audio/create-transcription"},{"title":"Create Translation","openapi":"post /audio/translations","href":"/api-reference/inference-api/audio/create-translation"}]},{"group":"Other APIs","pages":[{"title":"Gateway to Other APIs","icon":"chart-network","href":"/api-reference/inference-api/gateway-for-other-apis"}]},{"group":"Completions","pages":[{"title":"Completions","openapi":"post /completions","href":"/api-reference/inference-api/completions"}]},{"group":"Moderations","pages":[{"title":"Moderations","openapi":"post /moderations","href":"/api-reference/inference-api/moderations"}]},{"group":"Fine-tuning","pages":[{"title":"Create Fine-tuning Job","openapi":"post /fine_tuning/jobs","href":"/api-reference/inference-api/fine-tuning/create-fine-tuning-job"},{"title":"List Fine-tuning Jobs","openapi":"get /fine_tuning/jobs","href":"/api-reference/inference-api/fine-tuning/list-fine-tuning-jobs"},{"title":"Retrieve Fine-tuning Job","openapi":"get /fine_tuning/jobs/{fine_tuning_job_id}","href":"/api-reference/inference-api/fine-tuning/retrieve-fine-tuning-job"},{"title":"List Fine-tuning Events","openapi":"get /fine_tuning/jobs/{fine_tuning_job_id}/events","href":"/api-reference/inference-api/fine-tuning/list-fine-tuning-events"},{"title":"List Fine-tuning Checkpoints","openapi":"get /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints","href":"/api-reference/inference-api/fine-tuning/list-fine-tuning-checkpoints"},{"title":"Cancel Fine-tuning","openapi":"post /fine_tuning/jobs/{fine_tuning_job_id}/cancel","href":"/api-reference/inference-api/fine-tuning/cancel-fine-tuning"}]},{"group":"Batch","pages":[{"title":"Create Batch","openapi":"post /batches","href":"/api-reference/inference-api/batch/create-batch"},{"title":"List Batch","openapi":"get /batches","href":"/api-reference/inference-api/batch/list-batch"},{"title":"Retrieve Batch","openapi":"get /batches/{batch_id}","href":"/api-reference/inference-api/batch/retrieve-batch"},{"title":"Cancel Batch","openapi":"post /batches/{batch_id}/cancel","href":"/api-reference/inference-api/batch/cancel-batch"}]},{"group":"Files","pages":[{"title":"Upload File","openapi":"post /files","href":"/api-reference/inference-api/files/upload-file"},{"title":"List Files","openapi":"get /files","href":"/api-reference/inference-api/files/list-files"},{"title":"Retrieve File","openapi":"get /files/{file_id}","href":"/api-reference/inference-api/files/retrieve-file"},{"title":"Retrieve File Content","openapi":"get /files/{file_id}/content","href":"/api-reference/inference-api/files/retrieve-file-content"},{"title":"Delete File","openapi":"delete /files/{file_id}","href":"/api-reference/inference-api/files/delete-file"}]},{"group":"Assistants","pages":[{"group":"Assistants","pages":[{"title":"Create Assistant","openapi":"post /assistants","href":"/api-reference/inference-api/assistants-api/assistants/create-assistant"},{"title":"List Assistant","openapi":"get /assistants","href":"/api-reference/inference-api/assistants-api/assistants/list-assistants"},{"title":"Retrieve Assistant","openapi":"get /assistants/{assistant_id}","href":"/api-reference/inference-api/assistants-api/assistants/retrieve-assistant"},{"title":"Modify Assistant","openapi":"post /assistants/{assistant_id}","href":"/api-reference/inference-api/assistants-api/assistants/modify-assistant"},{"title":"Delete Assistant","openapi":"delete /assistants/{assistant_id}","href":"/api-reference/inference-api/assistants-api/assistants/delete-assistant"}]},{"group":"Threads","pages":[{"title":"Create Thread","openapi":"post /threads","href":"/api-reference/inference-api/assistants-api/threads/create-thread"},{"title":"Retrieve Thread","openapi":"get /threads/{thread_id}","href":"/api-reference/inference-api/assistants-api/threads/retrieve-thread"},{"title":"Modify Thread","openapi":"post /threads/{thread_id}","href":"/api-reference/inference-api/assistants-api/threads/modify-thread"},{"title":"Delete Thread","openapi":"delete /threads/{thread_id}","href":"/api-reference/inference-api/assistants-api/threads/delete-thread"}]},{"group":"Messages","pages":[{"title":"Create Message","openapi":"post /threads/{thread_id}/messages","href":"/api-reference/inference-api/assistants-api/messages/create-message"},{"title":"List Message","openapi":"get /threads/{thread_id}/messages","href":"/api-reference/inference-api/assistants-api/messages/list-messages"},{"title":"Retrieve Message","openapi":"get /threads/{thread_id}/messages/{message_id}","href":"/api-reference/inference-api/assistants-api/messages/retrieve-message"},{"title":"Modify Message","openapi":"post /threads/{thread_id}/messages/{message_id}","href":"/api-reference/inference-api/assistants-api/messages/modify-message"},{"title":"Delete Message","openapi":"delete /threads/{thread_id}/messages/{message_id}","href":"/api-reference/inference-api/assistants-api/messages/delete-message"}]},{"group":"Runs","pages":[{"title":"Create Run","openapi":"post /threads/{thread_id}/runs","href":"/api-reference/inference-api/assistants-api/runs/create-run"},{"title":"Create thread and Run","openapi":"post /threads/runs","href":"/api-reference/inference-api/assistants-api/runs/create-thread-and-run"},{"title":"list Run","openapi":"get /threads/{thread_id}/runs","href":"/api-reference/inference-api/assistants-api/runs/list-runs"},{"title":"Retrieve Run","openapi":"get /threads/{thread_id}/runs/{run_id}","href":"/api-reference/inference-api/assistants-api/runs/retrieve-run"},{"title":"Modify Run","openapi":"post /threads/{thread_id}/runs/{run_id}","href":"/api-reference/inference-api/assistants-api/runs/modify-run"},{"title":"Submit Tool Outputs to Run","openapi":"post /threads/{thread_id}/runs/{run_id}/submit_tool_outputs","href":"/api-reference/inference-api/assistants-api/runs/submit-tool-outputs-to-run"},{"title":"Cancel Run","openapi":"post /threads/{thread_id}/runs/{run_id}/cancel","href":"/api-reference/inference-api/assistants-api/runs/cancel-run"}]},{"group":"Run Steps","pages":[{"title":"List Run Steps","openapi":"get /threads/{thread_id}/runs/{run_id}/steps","href":"/api-reference/inference-api/assistants-api/run-steps/list-run-steps"},{"title":"Retrieve Run Steps","openapi":"get /threads/{thread_id}/runs/{run_id}/steps/{step_id}","href":"/api-reference/inference-api/assistants-api/run-steps/retrieve-run-steps"}]}]}]},{"tab":"Admin APIs","pages":[{"title":"Admin APIs","href":"/api-reference/admin-api/introduction"}]},{"tab":"Cookbooks","pages":[{"title":"Cookbooks","href":"/guides/use-cases/run-batch-evals"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog/2026/september"}]},{"tab":"Help Center","pages":[{"title":"Help Center","href":"/help-center/you-do-not-have-enough-permissions"}]}]},{"version":"Prisma AIRS","pages":[{"title":"Prisma AIRS","href":"/aigw/introduction/welcome"}]},{"version":"Virtual Keys (Deprecated)","tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/virtual_key_old/introduction/what-is-portkey"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/virtual_key_old/integrations/ecosystem"}]},{"tab":"Inference API","groups":[{"group":"API Reference","pages":[{"title":"Introduction","href":"/api-reference/inference-api/introduction"},{"title":"Agentic Usage","href":"/api-reference/inference-api/agentic-usage"},{"title":"Supported Providers","href":"/api-reference/inference-api/supported-providers"},{"title":"Authentication","href":"/api-reference/inference-api/authentication"},{"title":"Headers","href":"/api-reference/inference-api/headers"},{"title":"Errors","href":"/api-reference/inference-api/error-codes"},{"title":"Response Schema","href":"/api-reference/inference-api/response-schema"},{"group":"More","pages":[{"title":"Gateway Config Object","href":"/api-reference/inference-api/config-object"},{"title":"OpenAPI Specification","url":"https://github.com/Portkey-AI/openapi","href":"/api-reference/inference-api/open-api-specification"}]}]},{"group":"SDK","pages":[{"title":"Supported SDKs","href":"/api-reference/sdk/list"},{"title":"Python","href":"/api-reference/sdk/python"},{"title":"Node.js","href":"/api-reference/sdk/node"},{"title":"C# (.NET)","description":"Integrate Portkey in your `.NET` app easily using the OpenAI library and get advanced monitoring, routing, and enterprise features.","href":"/api-reference/sdk/c-sharp"}]},{"group":"Chat Completions","pages":[{"title":"Chat","openapi":"post /chat/completions","href":"/api-reference/inference-api/chat"}]},{"group":"Responses","pages":[{"title":"Create a Response","openapi":"post /responses","description":"","href":"/api-reference/inference-api/responses/responses"},{"title":"Get a Response","openapi":"get /responses/{response_id}","href":"/api-reference/inference-api/responses/retrieve-response"},{"title":"Delete a Response","openapi":"delete /responses/{response_id}","href":"/api-reference/inference-api/responses/delete-response"},{"title":"List Input Items","openapi":"get /responses/{response_id}/input_items","href":"/api-reference/inference-api/responses/retrieve-inputs"}]},{"group":"Portkey Endpoints","pages":[{"title":"Prompt Completions","openapi":"post /prompts/{promptId}/completions","href":"/api-reference/inference-api/prompts/prompt-completion"},{"title":"Prompt Render","openapi":"post /prompts/{promptId}/render","href":"/api-reference/inference-api/prompts/render"},{"title":"Insert a Log","openapi":"post /logs","href":"/api-reference/admin-api/data-plane/logs/insert-a-log"},{"title":"Create Feedback","openapi":"post /feedback","href":"/api-reference/admin-api/data-plane/feedback/create-feedback"},{"title":"Update Feedback","openapi":"put /feedback/{id}","href":"/api-reference/admin-api/data-plane/feedback/update-feedback"},{"group":"Log Exports","pages":[{"title":"Retrieve a Log Export","openapi":"get /logs/exports/{exportId}","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/retrieve-a-log-export"},{"title":"Update a Log Export","openapi":"put /logs/exports/{exportId}","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/update-a-log-export"},{"title":"List a Log Export","openapi":"get /logs/exports","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/list-log-exports"},{"title":"Create a Log Export","openapi":"post /logs/exports","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/create-a-log-export"},{"title":"Start a Log Export","openapi":"post /logs/exports/{exportId}/start","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/start-a-log-export"},{"title":"Cancel a Log Export","openapi":"post /logs/exports/{exportId}/cancel","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/cancel-a-log-export"},{"title":"Delete a Log Export","openapi":"delete /logs/exports/{exportId}","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/delete-a-log-export"},{"title":"Download a Log Export","openapi":"get /logs/exports/{exportId}/download","href":"/api-reference/admin-api/data-plane/logs/log-exports-beta/download-a-log-export"}]}]},{"group":"Embeddings","pages":[{"title":"Embeddings","openapi":"post /embeddings","href":"/api-reference/inference-api/embeddings"}]},{"group":"Rerank","pages":[{"title":"Rerank","openapi":"post /rerank","href":"/api-reference/inference-api/rerank"}]},{"group":"Decisions","pages":[{"title":"Decisions","openapi":"post /decisions","href":"/api-reference/inference-api/decisions"}]},{"group":"OCR","pages":[{"title":"OCR","openapi":"post /ocr","href":"/api-reference/inference-api/ocr"}]},{"group":"Images","pages":[{"title":"Create Image","openapi":"post /images/generations","href":"/api-reference/inference-api/images/create-image"},{"title":"Create Image Edit","openapi":"post /images/edits","href":"/api-reference/inference-api/images/create-image-edit"},{"title":"Create Image Variation","openapi":"post /images/variations","href":"/api-reference/inference-api/images/create-image-variation"}]},{"group":"Audio","pages":[{"title":"Create Speech","openapi":"post /audio/speech","href":"/api-reference/inference-api/audio/create-speech"},{"title":"Create Transcription","openapi":"post /audio/transcriptions","href":"/api-reference/inference-api/audio/create-transcription"},{"title":"Create Translation","openapi":"post /audio/translations","href":"/api-reference/inference-api/audio/create-translation"}]},{"group":"Other APIs","pages":[{"title":"Gateway to Other APIs","icon":"chart-network","href":"/api-reference/inference-api/gateway-for-other-apis"}]},{"group":"Completions","pages":[{"title":"Completions","openapi":"post /completions","href":"/api-reference/inference-api/completions"}]},{"group":"Moderations","pages":[{"title":"Moderations","openapi":"post /moderations","href":"/api-reference/inference-api/moderations"}]},{"group":"Fine-tuning","pages":[{"title":"Create Fine-tuning Job","openapi":"post /fine_tuning/jobs","href":"/api-reference/inference-api/fine-tuning/create-fine-tuning-job"},{"title":"List Fine-tuning Jobs","openapi":"get /fine_tuning/jobs","href":"/api-reference/inference-api/fine-tuning/list-fine-tuning-jobs"},{"title":"Retrieve Fine-tuning Job","openapi":"get /fine_tuning/jobs/{fine_tuning_job_id}","href":"/api-reference/inference-api/fine-tuning/retrieve-fine-tuning-job"},{"title":"List Fine-tuning Events","openapi":"get /fine_tuning/jobs/{fine_tuning_job_id}/events","href":"/api-reference/inference-api/fine-tuning/list-fine-tuning-events"},{"title":"List Fine-tuning Checkpoints","openapi":"get /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints","href":"/api-reference/inference-api/fine-tuning/list-fine-tuning-checkpoints"},{"title":"Cancel Fine-tuning","openapi":"post /fine_tuning/jobs/{fine_tuning_job_id}/cancel","href":"/api-reference/inference-api/fine-tuning/cancel-fine-tuning"}]},{"group":"Batch","pages":[{"title":"Create Batch","openapi":"post /batches","href":"/api-reference/inference-api/batch/create-batch"},{"title":"List Batch","openapi":"get /batches","href":"/api-reference/inference-api/batch/list-batch"},{"title":"Retrieve Batch","openapi":"get /batches/{batch_id}","href":"/api-reference/inference-api/batch/retrieve-batch"},{"title":"Cancel Batch","openapi":"post /batches/{batch_id}/cancel","href":"/api-reference/inference-api/batch/cancel-batch"}]},{"group":"Files","pages":[{"title":"Upload File","openapi":"post /files","href":"/api-reference/inference-api/files/upload-file"},{"title":"List Files","openapi":"get /files","href":"/api-reference/inference-api/files/list-files"},{"title":"Retrieve File","openapi":"get /files/{file_id}","href":"/api-reference/inference-api/files/retrieve-file"},{"title":"Retrieve File Content","openapi":"get /files/{file_id}/content","href":"/api-reference/inference-api/files/retrieve-file-content"},{"title":"Delete File","openapi":"delete /files/{file_id}","href":"/api-reference/inference-api/files/delete-file"}]},{"group":"Assistants","pages":[{"group":"Assistants","pages":[{"title":"Create Assistant","openapi":"post /assistants","href":"/api-reference/inference-api/assistants-api/assistants/create-assistant"},{"title":"List Assistant","openapi":"get /assistants","href":"/api-reference/inference-api/assistants-api/assistants/list-assistants"},{"title":"Retrieve Assistant","openapi":"get /assistants/{assistant_id}","href":"/api-reference/inference-api/assistants-api/assistants/retrieve-assistant"},{"title":"Modify Assistant","openapi":"post /assistants/{assistant_id}","href":"/api-reference/inference-api/assistants-api/assistants/modify-assistant"},{"title":"Delete Assistant","openapi":"delete /assistants/{assistant_id}","href":"/api-reference/inference-api/assistants-api/assistants/delete-assistant"}]},{"group":"Threads","pages":[{"title":"Create Thread","openapi":"post /threads","href":"/api-reference/inference-api/assistants-api/threads/create-thread"},{"title":"Retrieve Thread","openapi":"get /threads/{thread_id}","href":"/api-reference/inference-api/assistants-api/threads/retrieve-thread"},{"title":"Modify Thread","openapi":"post /threads/{thread_id}","href":"/api-reference/inference-api/assistants-api/threads/modify-thread"},{"title":"Delete Thread","openapi":"delete /threads/{thread_id}","href":"/api-reference/inference-api/assistants-api/threads/delete-thread"}]},{"group":"Messages","pages":[{"title":"Create Message","openapi":"post /threads/{thread_id}/messages","href":"/api-reference/inference-api/assistants-api/messages/create-message"},{"title":"List Message","openapi":"get /threads/{thread_id}/messages","href":"/api-reference/inference-api/assistants-api/messages/list-messages"},{"title":"Retrieve Message","openapi":"get /threads/{thread_id}/messages/{message_id}","href":"/api-reference/inference-api/assistants-api/messages/retrieve-message"},{"title":"Modify Message","openapi":"post /threads/{thread_id}/messages/{message_id}","href":"/api-reference/inference-api/assistants-api/messages/modify-message"},{"title":"Delete Message","openapi":"delete /threads/{thread_id}/messages/{message_id}","href":"/api-reference/inference-api/assistants-api/messages/delete-message"}]},{"group":"Runs","pages":[{"title":"Create Run","openapi":"post /threads/{thread_id}/runs","href":"/api-reference/inference-api/assistants-api/runs/create-run"},{"title":"Create thread and Run","openapi":"post /threads/runs","href":"/api-reference/inference-api/assistants-api/runs/create-thread-and-run"},{"title":"list Run","openapi":"get /threads/{thread_id}/runs","href":"/api-reference/inference-api/assistants-api/runs/list-runs"},{"title":"Retrieve Run","openapi":"get /threads/{thread_id}/runs/{run_id}","href":"/api-reference/inference-api/assistants-api/runs/retrieve-run"},{"title":"Modify Run","openapi":"post /threads/{thread_id}/runs/{run_id}","href":"/api-reference/inference-api/assistants-api/runs/modify-run"},{"title":"Submit Tool Outputs to Run","openapi":"post /threads/{thread_id}/runs/{run_id}/submit_tool_outputs","href":"/api-reference/inference-api/assistants-api/runs/submit-tool-outputs-to-run"},{"title":"Cancel Run","openapi":"post /threads/{thread_id}/runs/{run_id}/cancel","href":"/api-reference/inference-api/assistants-api/runs/cancel-run"}]},{"group":"Run Steps","pages":[{"title":"List Run Steps","openapi":"get /threads/{thread_id}/runs/{run_id}/steps","href":"/api-reference/inference-api/assistants-api/run-steps/list-run-steps"},{"title":"Retrieve Run Steps","openapi":"get /threads/{thread_id}/runs/{run_id}/steps/{step_id}","href":"/api-reference/inference-api/assistants-api/run-steps/retrieve-run-steps"}]}]}]},{"tab":"Admin API","pages":[{"title":"Admin API","href":"/api-reference/admin-api/introduction"}]},{"tab":"Cookbooks","pages":[{"title":"Cookbooks","href":"/guides/use-cases/run-batch-evals"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog/2025/may"}]},{"tab":"Help articles","pages":[{"title":"Help articles","href":"/help-center/you-do-not-have-enough-permissions"}]}]}]},"title":"Chat - Portkey (Prisma AIRS AI Gateway) Docs","buildId":"dpl_AUojGTPodKNPTVaxVPcxnNvkSVqo","deploymentId":"dpl_AUojGTPodKNPTVaxVPcxnNvkSVqo","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-D2GYGXhJ.js","utils-BFd71lo2.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-i162M7Za.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-oUw0la6W.js","snippetPresets-DtIWL37f.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-BCMBbEQM.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-DC4RgS91.js","shallow-CgVeLRFv.js","getApiPlaygroundDisplay-D5biMY5x.js","CodeSnippet-BFsbT-Fu.js","CodeSnippets-zLLOIece.js","Page-Ddn8iQDL.js","getPastedJson-BrHW4jRt.js","icon-CkMCp-Tk.js","MethodPill-CCcSM-Ep.js","DuplicateIcon-4tBrFI-V.js","createIcon-YbZxtfvX.js","DynamicMarkdown-BQC1aHST.js","SectionHeading-Dyh8yRs0.js","axios-vUo_bRtp.js","Markdown-DnRxVfNy.js","clsx-BHwt7gjg.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-CI1QhstW.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-Ctpizp2W.js"]}