> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sudoapp.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI SDK Compatability

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.

<Note>This compatability is not suitable for future-proof and production use cases, and is better for testing and validation.</Note>

<Warning>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 </Warning>

# Using the OpenAI SDK

Using an official SDK by OpenAI, do the following:

1. Change the base URL to Sudo's chat API URL: [https://sudoapp.dev/api/v1/](https://sudoapp.dev/api/v1/)
2. Change the API key to your **Sudo API key**, which you can get from the [dev dashboard](https://staging.sudoapp.dev/dev/dashboard).

Now, you can call Sudo's chat API with **any** supported AI model of your choice.

<CodeGroup>
  ```python Python theme={null}
  import openai

  # Replace with your Sudo API key
  openai.api_key = "your-sudo-api-key"
  # Set the custom base URL
  openai.base_url = "https://sudoapp.dev/api/v1/"

  # Make a test call to the chat endpoint
  response = 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)
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from "openai";

  // Initialize the OpenAI client with Sudo config
  const 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);
  ```
</CodeGroup>

## Next Steps

Explore the API capabilities and available models:

<CardGroup cols={2}>
  <Card title="API Reference" icon="link" href="/api-ref/overview" />

  <Card title="Supported Models" icon="brain" href="models" />
</CardGroup>
