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

# AI Gateway | Quick Start

> Connect a provider, get an API key, and route the first request through the AI Gateway in under five minutes.

Already running LLM calls? Point them at the **AI Gateway** to route across providers, add fallbacks, and centralize cost and latency tracking with a single base URL change.

<Steps>
  <Step>
    ### Create an account

    [Sign up](https://my.orq.ai/auth/signup) for a free **orq.ai** account. New accounts land directly in the **AI Gateway** application at `/{workspace}/gateway`.
  </Step>

  <Step>
    ### Connect a provider

    The **AI Gateway** routes requests through provider credentials configured in the workspace, keeping spend and data fully under control.

    1. In the **AI Gateway** sidebar, go to **BYOK**.
    2. Pick a provider (this quickstart uses [OpenAI](/docs/ai-gateway/integrations/providers/openai)) and click **Connect**.
    3. Choose **Setup your own API key** and paste the provider key.

    <Info>
      No OpenAI key yet? Create one at [platform.openai.com/api-keys](https://platform.openai.com/api-keys). For other providers, see the [providers overview](/docs/ai-gateway/integrations/providers/overview).
    </Info>

    <Card title="Supported providers" icon="plug" href="/docs/ai-gateway/integrations/providers/overview">
      See the full list of supported model providers and how to connect them.
    </Card>
  </Step>

  <Step>
    ### Get an API key

    In the **AI Gateway** sidebar, go to **API Keys**. Click **Create API Key**, give it a name, and copy it.

    Then run the command below in a terminal, replacing `your-api-key-here` with the key copied above. The code samples in the next step read from this environment variable.

    <CodeGroup>
      ```bash macOS / Linux theme={"theme":{"light":"github-light","dark":"github-dark"}}
      export ORQ_API_KEY="your-api-key-here"
      ```

      ```powershell Windows theme={"theme":{"light":"github-light","dark":"github-dark"}}
      $env:ORQ_API_KEY = "your-api-key-here"
      ```
    </CodeGroup>
  </Step>

  <Step>
    ### Make a request

    Send a request to the unified `/v3/router/responses` endpoint using the provider-prefixed model id (e.g. `openai/gpt-5.4`).

    <Tabs>
      <Tab title="API & SDK" icon="code">
        <CodeGroup>
          ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
          curl -X POST https://api.orq.ai/v3/router/responses \
            -H "Authorization: Bearer $ORQ_API_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "model": "openai/gpt-5.4",
              "input": "Hello, world!"
            }'
          ```

          ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
          import OpenAI from "openai";

          const client = new OpenAI({
            baseURL: "https://api.orq.ai/v3/router",
            apiKey: process.env.ORQ_API_KEY,
          });

          const response = await client.responses.create({
            model: "openai/gpt-5.4",
            input: "Hello, world!",
          });

          console.log(response.output_text);
          ```

          ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
          import os
          from openai import OpenAI

          client = OpenAI(
              base_url="https://api.orq.ai/v3/router",
              api_key=os.environ["ORQ_API_KEY"],
          )

          response = client.responses.create(
              model="openai/gpt-5.4",
              input="Hello, world!",
          )

          print(response.output_text)
          ```
        </CodeGroup>

        A successful response looks like:

        ```json JSON theme={"theme":{"light":"github-light","dark":"github-dark"}}
        {
          "id": "resp_01K7M0YTJ6X90VHPRDMM5GEC4R",
          "object": "response",
          "model": "gpt-5.4",
          "output": [
            {
              "type": "message",
              "role": "assistant",
              "content": [
                {
                  "type": "output_text",
                  "text": "Hello! How can I assist you today?"
                }
              ]
            }
          ],
          "usage": { "input_tokens": 14, "output_tokens": 11, "total_tokens": 25 }
        }
        ```
      </Tab>

      <Tab title="Frameworks" icon="puzzle-piece">
        Already using an agent or LLM framework? Point its base URL at the **AI Gateway** and route every call through **orq.ai** with no other code changes.

        <CardGroup cols={2}>
          <Card title="LangGraph" icon="diagram-project" href="/docs/ai-gateway/integrations/frameworks/langgraph">
            Stateful, multi-step graphs with full **AI Gateway** access.
          </Card>

          <Card title="Vercel AI SDK" icon="bolt" href="/docs/ai-gateway/integrations/frameworks/vercel-ai">
            Stream responses to React Server Components and edge runtime apps.
          </Card>

          <Card title="OpenAI Agents SDK" icon="robot" href="/docs/ai-gateway/integrations/frameworks/openai-agents">
            Multi-agent handoffs and tool calls routed through the **AI Gateway**.
          </Card>

          <Card title="Agno" icon="layer-group" href="/docs/ai-gateway/integrations/frameworks/agno">
            Production Python agents with structured workflows and tool integration.
          </Card>
        </CardGroup>

        <Card title="All frameworks" icon="grid-2" href="/docs/ai-gateway/integrations/frameworks/overview">
          See every supported framework: LangChain, CrewAI, LlamaIndex, Mastra, Pydantic AI, Semantic Kernel, and more.
        </Card>
      </Tab>
    </Tabs>
  </Step>

  <Step>
    ### Review the request

    In the **AI Gateway** sidebar, go to **[Traces](/docs/ai-gateway/traces)** to see the request, model, latency, token counts, and cost.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    1. Confirm `echo $ORQ_API_KEY` returns the value you expect.
    2. Verify the key under **API Keys** in the **AI Gateway** sidebar is active.
    3. Make sure the `Authorization: Bearer` header is set, not a query parameter.
  </Accordion>

  <Accordion title="Provider not configured">
    ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {"code":401,"error":"API key for openai is not configured in your workspace."}
    ```

    Go to **Providers** in the **AI Gateway** sidebar, open the matching provider, and click **Setup your own API key**.
  </Accordion>

  <Accordion title="Model not enabled">
    Some models require an explicit toggle in the **AI Gateway**. Search for the model id under **Models** and enable it before invoking it.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Auto Router" icon="wand-magic-sparkles" href="/docs/ai-gateway/auto-router">
    Let the gateway pick the optimal model per request based on quality, cost, and latency.
  </Card>

  <Card title="Fallbacks and retries" icon="shuffle" href="/docs/ai-gateway/features/retries">
    Define backup models so requests survive provider outages automatically.
  </Card>

  <Card title="Identities" icon="user-tag" href="/docs/ai-gateway/identities">
    Attribute usage and cost to a specific end user or tenant.
  </Card>

  <Card title="Supported models" icon="list" href="/docs/ai-gateway/supported-models">
    Browse 300+ models across OpenAI, Anthropic, Google, AWS, Azure, and more.
  </Card>
</CardGroup>
