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

# OpenAI Compatibility

Inworld Router is fully compatible with the OpenAI SDK. By simply changing the `base_url` and `api_key`, you can add the capabilities of Inworld Router to your existing apps.

## Endpoint

The OpenAI-compatible API endpoint is available at:

```
https://api.inworld.ai/v1
```

To use Inworld Router, change your API call URL or SDK base URL from `https://api.openai.com/v1` to `https://api.inworld.ai/v1`.

## OpenAI SDK

Below is an example request using OpenAI's SDK

<CodeGroup>
  ```python Python theme={"system"}
  from openai import OpenAI

  # Initialize the client with Inworld Router credentials
  client = OpenAI(
      base_url="https://api.inworld.ai/v1",
      api_key="YOUR_INWORLD_API_KEY" # Your Inworld API Key
  )

  # Call your router
  response = client.chat.completions.create(
      model="inworld/<router-id>",
      messages=[
          {"role": "user", "content": "Who created you?"}
      ]
  )

  print(response.choices[0].message.content)
  ```

  ```javascript Node theme={"system"}
  import OpenAI from 'openai';

  const openai = new OpenAI({
    baseURL: 'https://api.inworld.ai/v1',
    apiKey: 'YOUR_INWORLD_API_KEY',
  });

  async function main() {
    const completion = await openai.chat.completions.create({
      messages: [{ role: 'user', content: 'Who created you?' }],
      model: 'inworld/demo-router'
    });

    console.log(completion.choices[0].message.content);
  }

  main();
  ```
</CodeGroup>
