The Sudo developer platform maintains parity with the OpenAI Chat Completions API, allowing you to use the OpenAI SDK to access Sudo’s AI routing. By changing just two parameters, you can use the OpenAI SDK to build with Sudo today.
This compatability is not suitable for future-proof and production use cases, and is better for testing and validation.
Recall that each model provider has different degrees of support for OpenAI features (e.g. Anthropic models do not support response_format parameter). You must refer to their documentation of OpenAI compatability when in doubt
Using the OpenAI SDK
Using an official SDK by OpenAI, do the following:
Change the API key to your Sudo API key, which you can get from the dev dashboard.
Now, you can call Sudo’s chat API with any supported AI model of your choice.
import openai# Replace with your Sudo API keyopenai.api_key = "your-sudo-api-key"# Set the custom base URLopenai.base_url = "https://sudoapp.dev/api/v1/"# Make a test call to the chat endpointresponse = openai.chat.completions.create( model="claude-sonnet-4-20250514", # or "gpt-4", "gemini-2.0-flash", etc. messages=[ {"role": "user", "content": "Hello! What is the capital of France?"} ], temperature=0.7,)print("Response:")print(response.choices[0].message.content)
import OpenAI from "openai";// Initialize the OpenAI client with Sudo configconst openai = new OpenAI({ apiKey: "your-sudo-api-key", // Replace with your Sudo API key baseURL: "http://sudoapp.dev/api/v1/",});async function testChat() { const response = await openai.chat.completions.create({ model: "claude-sonnet-4-20250514", // or any model string messages: [{ role: "user", content: "Hello! What is the capital of France?" }], temperature: 0.7, }); console.log("Response:"); console.log(response.choices[0].message?.content);}testChat().catch(console.error);
Next Steps
Explore the API capabilities and available models:
API Reference
Supported Models
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Sudo Developer Platform","colors":{"primary":"#F74E00","light":"#FDFDFD","dark":"#000000"},"logo":{"light":"https://mintcdn.com/lita/J7nEUwxW1-PGv48x/SUDO.svg?fit=max\u0026auto=format\u0026n=J7nEUwxW1-PGv48x\u0026q=85\u0026s=73952c0e2019fd50f94b90e4431d8949","dark":"https://mintcdn.com/lita/J7nEUwxW1-PGv48x/SUDO_Darkmode.svg?fit=max\u0026auto=format\u0026n=J7nEUwxW1-PGv48x\u0026q=85\u0026s=f4276bf149da1733e72c5d4f2d6bbaa2"},"favicon":"/Favicon.svg","navbar":{"primary":{"type":"button","label":"Sudo Developer Portal","href":"https://sudoapp.dev/dev/login"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lita","hasAudioNarration":false,"actualSubdomain":"lita","customDomains":["docs.sudoapp.dev"],"gitSource":{"type":"github","owner":"lita-xyz","repo":"sudo","deployBranch":"docs-permanent","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae929382aa543bea3368595:success","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"API Reference","count":15},{"language":"default","tag":"SDKs","count":13},{"language":"default","tag":"Sudo SDK","count":12},{"language":"default","tag":"Endpoints","count":10},{"language":"default","tag":"Router","count":7},{"language":"default","tag":"Overview","count":3},{"language":"default","tag":"System","count":2},{"language":"default","tag":"Responses API","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","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":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","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":"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":"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":"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":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","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":"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":"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":"turbopuffer-dual-write","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},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","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}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"sdk/openai-sdk","slug":"/sdk/openai-sdk","pageMetadata":{"title":"OpenAI SDK Compatability","icon":"handshake","description":null,"href":"/sdk/openai-sdk"},"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={a:`a`,code:`code`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{Card,CardGroup,CodeBlock,CodeGroup,Heading,Note,Warning}=_components;if(!Card)_missingMdxReference(`Card`,true);if(!CardGroup)_missingMdxReference(`CardGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The Sudo developer platform maintains parity with the OpenAI `,_jsx(_components.em,{children:`Chat Completions`}),` API, allowing you to use the `,_jsx(_components.strong,{children:`OpenAI SDK`}),` to access Sudo’s AI routing. By changing just two parameters, you can use the OpenAI SDK to build with Sudo today.`]}),`\n`,_jsx(Note,{children:`This compatability is not suitable for future-proof and production use cases, and is better for testing and validation.`}),`\n`,_jsxs(Warning,{children:[`Recall that each model provider has different degrees of support for OpenAI features (e.g. Anthropic models do not support `,_jsx(_components.code,{children:`response_format`}),` parameter). You must refer to their documentation of OpenAI compatability when in doubt `]}),`\n`,_jsx(Heading,{level:`1`,id:`using-the-openai-sdk`,children:`Using the OpenAI SDK`}),`\n`,_jsx(_components.p,{children:`Using an official SDK by OpenAI, do the following:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Change the base URL to Sudo’s chat API URL: `,_jsx(_components.a,{href:`https://sudoapp.dev/api/v1/`,children:`https://sudoapp.dev/api/v1/`})]}),`\n`,_jsxs(_components.li,{children:[`Change the API key to your `,_jsx(_components.strong,{children:`Sudo API key`}),`, which you can get from the `,_jsx(_components.a,{href:`https://staging.sudoapp.dev/dev/dashboard`,children:`dev dashboard`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Now, you can call Sudo’s chat API with `,_jsx(_components.strong,{children:`any`}),` supported AI model of your choice.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`18`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`18`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Replace with your Sudo API key`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`openai.api_key `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"your-sudo-api-key\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Set the custom base URL`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`openai.base_url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://sudoapp.dev/api/v1/\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Make a test call to the chat endpoint`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai.chat.completions.create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-20250514\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# or \"gpt-4\", \"gemini-2.0-flash\", etc.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello! What is the capital of France?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` temperature`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.7`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Response:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.content)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`20`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`20`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"openai\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Initialize the OpenAI client with Sudo config`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` openai`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"your-sudo-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Replace with your Sudo API key`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` baseURL:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"http://sudoapp.dev/api/v1/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` testChat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openai`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"claude-sonnet-4-20250514\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// or any model string`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Hello! What is the capital of France?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` temperature:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.7`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Response:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`testChat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next Steps`}),`\n`,_jsx(_components.p,{children:`Explore the API capabilities and available models:`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`API Reference`,icon:`link`,href:`/api-ref/overview`}),_jsx(Card,{title:`Supported Models`,icon:`brain`,href:`models`})]})]})}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":{"config":{},"pageMetadata":{"title":"OpenAI SDK Compatability","icon":"handshake","description":null,"href":"/sdk/openai-sdk"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Using the OpenAI SDK","slug":"using-the-openai-sdk","depth":1,"children":[]},{"title":"Next Steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"lita","siteName":"Sudo Developer Platform","title":"OpenAI SDK Compatability - Sudo Developer Platform","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2025-11-14T23:43:30.211Z","originalFileLocation":"sdk/openai-sdk.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=\"Sudo Developer Platform\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_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=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"OpenAI SDK Compatability - Sudo Developer Platform\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Sudo Developer Platform\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.sudoapp.dev/sdk/openai-sdk\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lita.mintlify.site/_mintlify/api/og/v2?division=SDKs\u0026amp;title=OpenAI+SDK+Compatability\u0026amp;theme=432278ed1d3be2363893e220\u0026amp;signature=79e8ac15d173b69e26b0e7ddb50e1951bd32db4a04603c226dd06bd7cc7994a3\">\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=\"OpenAI SDK Compatability - Sudo Developer Platform\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lita.mintlify.site/_mintlify/api/og/v2?division=SDKs\u0026amp;title=OpenAI+SDK+Compatability\u0026amp;theme=432278ed1d3be2363893e220\u0026amp;signature=79e8ac15d173b69e26b0e7ddb50e1951bd32db4a04603c226dd06bd7cc7994a3\">\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=\"/mintlify-assets/_mintlify/favicons/lita/7zMeY05SaDwaNF1n/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Sudo Developer Platform\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#F74E00\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.sudoapp.dev/sdk/openai-sdk\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk/openai-sdk.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.sudoapp.dev/#organization\",\"name\":\"Sudo Developer Platform\",\"url\":\"https://docs.sudoapp.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lita/J7nEUwxW1-PGv48x/SUDO.svg?fit=max\u0026auto=format\u0026n=J7nEUwxW1-PGv48x\u0026q=85\u0026s=73952c0e2019fd50f94b90e4431d8949\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.sudoapp.dev#website\",\"name\":\"Sudo Developer Platform\",\"url\":\"https://docs.sudoapp.dev\",\"publisher\":{\"@id\":\"https://docs.sudoapp.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.sudoapp.dev/sdk/openai-sdk#webpage\",\"url\":\"https://docs.sudoapp.dev/sdk/openai-sdk\",\"name\":\"OpenAI SDK Compatability\",\"dateModified\":\"2025-11-14T23:43:30.211Z\",\"isPartOf\":{\"@id\":\"https://docs.sudoapp.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.sudoapp.dev/sdk/openai-sdk#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.sudoapp.dev/sdk/openai-sdk#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Sudo Developer Platform\",\"item\":\"https://docs.sudoapp.dev\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OpenAI SDK Compatability\",\"item\":\"https://docs.sudoapp.dev/sdk/openai-sdk\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.sudoapp.dev/sdk/openai-sdk#article\",\"headline\":\"OpenAI SDK Compatability\",\"name\":\"OpenAI SDK Compatability\",\"url\":\"https://docs.sudoapp.dev/sdk/openai-sdk\",\"mainEntityOfPage\":{\"@id\":\"https://docs.sudoapp.dev/sdk/openai-sdk#webpage\"},\"dateModified\":\"2025-11-14T23:43:30.211Z\",\"publisher\":{\"@id\":\"https://docs.sudoapp.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.sudoapp.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Sudo Developer Platform\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Sudo Developer Platform\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdk/openai-sdk.md","siteName":"Sudo Developer Platform","nav":{"global":null,"groups":[{"group":"Overview","pages":[{"title":"Introduction","href":"/overview/introduction"},{"title":"Quickstart","href":"/overview/quickstart-api"},{"title":"Supported AI Models","description":"Sudo supports dozens of models from top providers","href":"/overview/models"}]},{"group":"SDKs","icon":"hammer","pages":[{"title":"OpenAI SDK Compatability","icon":"handshake","href":"/sdk/openai-sdk"},{"group":"Sudo SDK","icon":"code","pages":[{"title":"Introduction","description":"Official SDK for the Sudo AI platform - developer-friendly, type-safe, and feature-complete","href":"/sdk/sudo-sdk"},{"title":"Installation \u0026 Setup","href":"/sdk/sudo-sdk/installation"},{"title":"System Endpoints","href":"/sdk/sudo-sdk/system-endpoints"},{"title":"AI Router","href":"/sdk/sudo-sdk/ai-responses"},{"title":"Responses api","href":"/sdk/sudo-sdk/responses_api"},{"title":"Image Generation","href":"/sdk/sudo-sdk/image-generation"},{"title":"Streaming","href":"/sdk/sudo-sdk/streaming"},{"title":"Tool Calling","href":"/sdk/sudo-sdk/tool-calling"},{"title":"Structured Output","href":"/sdk/sudo-sdk/structured-output"},{"title":"Image Input","href":"/sdk/sudo-sdk/image-input"},{"title":"Audio Chat Completions","href":"/sdk/sudo-sdk/audio_chat_completions"},{"title":"Reasoning","href":"/sdk/sudo-sdk/reasoning"},{"title":"CRUD Operations","href":"/sdk/sudo-sdk/crud-operations"}]}]},{"group":"API Reference","icon":"square-terminal","pages":[{"title":"Overview","href":"/api-ref/overview"},{"title":"Headers \u0026 Auth","href":"/api-ref/auth"},{"title":"Streaming","href":"/api-ref/streaming"},{"title":"Responses API","href":"/api-ref/responses_api"},{"title":"Rate Limits \u0026 Overload Handling","href":"/api-ref/rate_limits"},{"group":"Endpoints","icon":"code","pages":[{"group":"handlers::accounts::developers","pages":[]},{"group":"handlers::accounts::users","pages":[]},{"group":"handlers::ads::ad_exchange","pages":[]},{"group":"System","pages":[{"title":"System Health","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json get /system/health","href":"/api-reference/system/system-health"},{"title":"Get supported models","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json get /v1/models","href":"/api-reference/system/get-supported-models"}]},{"group":"handlers::system::info","pages":[]},{"group":"Router","pages":[{"title":"List Chat Completions","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json get /v1/chat/completions","href":"/api-reference/router/list-chat-completions"},{"title":"Create Chat Completion","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json post /v1/chat/completions","href":"/api-reference/router/create-chat-completion"},{"title":"Get a Chat Completion","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json get /v1/chat/completions/{completion_id}","href":"/api-reference/router/get-a-chat-completion"},{"title":"Update Chat Completion","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json post /v1/chat/completions/{completion_id}","href":"/api-reference/router/update-chat-completion"},{"title":"Delete Chat Completion","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json delete /v1/chat/completions/{completion_id}","href":"/api-reference/router/delete-chat-completion"},{"title":"Chat Completion Messages","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json get /v1/chat/completions/{completion_id}/messages","href":"/api-reference/router/chat-completion-messages"},{"title":"Generate Image","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json post /v1/images/generations","href":"/api-reference/router/generate-image"}]},{"group":"Responses API","pages":[{"title":"Create Response","deprecated":null,"version":null,"openapi":"https://sudoapp.dev/api/openapi.json post /v1/responses","href":"/api-reference/responses-api/create-response"}]}]}]}]},"basePath":"","title":"OpenAI SDK Compatability - Sudo Developer Platform","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}