> ## 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.

# Realtime Router Quickstart

> Learn how to make your first Realtime Router API request

This quickstart will walk you through creating your first LLM Router (via [Portal](#create-your-first-router-on-portal) or [API](#create-your-first-router-via-api)) and making your first request.

While this guide uses the OpenAI Chat Completions compatible `/v1/chat/completions` endpoint, you can also integrate with our [Anthropic Messages API compatible](/router/anthropic-compatibility) `/v1/messages` endpoint, [OpenAI SDK](/router/openai-compatibility#openai-sdk), and Anthropic SDK.

## Create your first Router on Portal

<Steps titleSize="h3">
  <Step title="Open Routers">
    In [Inworld Portal](https://platform.inworld.ai/), go to **Routers** and select "Compare frontier models".

    <img src="https://mintcdn.com/inworldai/svEAOmQzmNmj2miy/img/portal/create-preset-router.png?fit=max&auto=format&n=svEAOmQzmNmj2miy&q=85&s=1eadb29739eb555ccad9c27432f3ff53" alt="" width="1231" height="899" data-path="img/portal/create-preset-router.png" />
  </Step>

  <Step title="Create a router">
    Click **Save** to create this router, which splits your traffic between Anthropic's Opus 4.6, Google's Gemini 3.1 Pro, and OpenAI's GPT-5.2.

    <img src="https://mintcdn.com/inworldai/svEAOmQzmNmj2miy/img/portal/save-router.png?fit=max&auto=format&n=svEAOmQzmNmj2miy&q=85&s=60bdf705af0a62bf93c1009ef47337b4" alt="" width="1386" height="906" data-path="img/portal/save-router.png" />
  </Step>

  <Step title="Get your API Key">
    Go to [**API Keys**](https://platform.inworld.ai/api-keys) and click **Generate new key**. Copy the Base64 credentials.
  </Step>

  <Step title="Make your first request">
    Now run the following code to make your first request to your router.

    <CodeGroup>
      ```bash curl theme={"system"}
      curl --request POST \
        --url https://api.inworld.ai/v1/chat/completions \
        --header 'Authorization: Basic <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "inworld/compare-frontier-models",
          "messages": [
            {"role": "user", "content": "Who created you?"}
          ]
        }'
      ```
    </CodeGroup>

    If you run the request multiple times, you should see traffic split across Anthropic's Opus 4.6, Google's Gemini 3.1 Pro, and OpenAI's GPT-5.2.
  </Step>
</Steps>

## Create your first Router via API

<Steps titleSize="h3">
  <Step title="Get your API Key">
    In [Inworld Portal](https://platform.inworld.ai/), go to [**API Keys**](https://platform.inworld.ai/api-keys) and click **Generate new key**. Enable **Write** permissions for the Router API, and click **Generate**.

    Copy the Base64 credentials.

    <img src="https://mintcdn.com/inworldai/svEAOmQzmNmj2miy/img/portal/api-key-router.gif?s=865efc967c3b4578e220b0bab0af0959" alt="" width="1486" height="916" data-path="img/portal/api-key-router.gif" />
  </Step>

  <Step title="Create a router">
    Now let's create a router that splits your traffic between Anthropic's Opus 4.6, Google's Gemini 3.1 Pro, and OpenAI's GPT-5.2.

    <CodeGroup>
      ```shell curl theme={"system"}
      curl --location 'https://api.inworld.ai/router/v1/routers' \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Basic <your-api-key>' \
      --data '{
          "name": "compare-frontier-models",
          "default_route": {
              "route_id": "default",
              "variants": [
                  {
                      "variant": {
                          "variant_id": "anthropic",
                          "model_id": "anthropic/claude-opus-4-6"
                      },
                      "weight": 33
                  },
                  {
                      "variant": {
                          "variant_id": "google",
                          "model_id": "google-ai-studio/gemini-3.1-pro-preview"
                      },
                      "weight": 33
                  },
                  {
                      "variant": {
                          "variant_id": "openai",
                          "model_id": "openai/gpt-5.2"
                      },
                      "weight": 34
                  }
              ]
          }
      }'
      ```

      ```python Python theme={"system"}
      import requests

      url = "https://api.inworld.ai/router/v1/routers"
      headers = {
          "Content-Type": "application/json",
          "Authorization": "Basic <your-api-key>"
      }
      data = {
          "name": "compare-frontier-models",
          "default_route": {
              "route_id": "default",
              "variants": [
                  {
                      "variant": {
                          "variant_id": "anthropic",
                          "model_id": "anthropic/claude-opus-4-6"
                      },
                      "weight": 33
                  },
                  {
                      "variant": {
                          "variant_id": "google",
                          "model_id": "google-ai-studio/gemini-3.1-pro-preview"
                      },
                      "weight": 33
                  },
                  {
                      "variant": {
                          "variant_id": "openai",
                          "model_id": "openai/gpt-5.2"
                      },
                      "weight": 34
                  }
              ]
          }
      }

      response = requests.post(url, headers=headers, json=data)
      print(response.json())
      ```

      ```javascript JavaScript theme={"system"}
      const response = await fetch("https://api.inworld.ai/router/v1/routers", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": "Basic <your-api-key>"
        },
        body: JSON.stringify({
          name: "compare-frontier-models",
          default_route: {
            route_id: "default",
            variants: [
              {
                variant: {
                  variant_id: "anthropic",
                  model_id: "anthropic/claude-opus-4-6"
                },
                weight: 33
              },
              {
                variant: {
                  variant_id: "google",
                  model_id: "google-ai-studio/gemini-3.1-pro-preview"
                },
                weight: 33
              },
              {
                variant: {
                  variant_id: "openai",
                  model_id: "openai/gpt-5.2"
                },
                weight: 34
              }
            ]
          }
        })
      });

      const data = await response.json();
      console.log(data);
      ```
    </CodeGroup>
  </Step>

  <Step title="Make your first request">
    Now run the following code to make your first request to your router.

    <CodeGroup>
      ```bash curl theme={"system"}
      curl --request POST \
        --url https://api.inworld.ai/v1/chat/completions \
        --header 'Authorization: Basic <your-api-key>' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "inworld/compare-frontier-models",
          "messages": [
            {"role": "user", "content": "Who created you?"}
          ]
        }'
      ```
    </CodeGroup>

    If you run the request multiple times, you should see traffic split across Anthropic's Opus 4.6, Google's Gemini 3.1 Pro, and OpenAI's GPT-5.2.
  </Step>
</Steps>

## Next Steps

Now that you've made your first request, you can explore more of Inworld Router's capabilities.

<CardGroup cols={3}>
  <Card title="Explore" icon="search" href="/router/core-concepts/overview">
    Understand core router concepts, including fallbacks, conditional routing, and more
  </Card>

  <Card title="Routing Strategies" icon="shuffle" href="/router/capabilities/conditional-routing">
    Learn more about how to use conditional routing
  </Card>

  <Card title="API Reference" icon="books" href="/api-reference/routerAPI/chat-completions">
    View request and response schemas for Chat Completions and Router APIs
  </Card>
</CardGroup>
