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

# Quickstart

> Send your first LLM request through MetrixLLM in under 5 minutes.

MetrixLLM is a **drop-in replacement** for your existing AI provider SDK. You change your `baseURL` and API key — nothing else.

<Steps>
  <Step title="Create an account">
    Sign up at [app.metrixllm.com](https://app.metrixllm.com) and create your first **Workspace**.

    A workspace is an isolated environment with its own API keys, logs, and routing rules. A common setup is one workspace per environment: `Production`, `Staging`, `Development`.
  </Step>

  <Step title="Add a provider key">
    MetrixLLM uses **Bring Your Own Key (BYOK)** — you connect your own OpenAI, Anthropic, or other provider credentials.

    1. In your workspace, go to **Settings → Providers**
    2. Click **Add Provider**
    3. Select the provider and paste your API key
    4. Click **Save**

    Your key is encrypted at rest immediately.
  </Step>

  <Step title="Create a MetrixLLM API key">
    1. In your workspace, click **API Keys** in the sidebar
    2. Click **Create API Key**
    3. Name it (e.g. `Backend - Production`)
    4. Copy the key — it starts with `mtx_` and is shown **only once**

    <Warning>
      Store your key in an environment variable. Never commit it to source control.
    </Warning>
  </Step>

  <Step title="Point your SDK to MetrixLLM">
    Change only the `base_url` and `api_key` in your existing code. Everything else stays the same.

    <CodeGroup>
      ```python Python (OpenAI SDK) theme={null}
      from openai import OpenAI

      client = OpenAI(
          base_url="https://gateway.metrixllm.com/openai/v1",
          api_key="mtx_..."  # Your MetrixLLM API key
      )

      response = client.chat.completions.create(
          model="gpt-4o",
          messages=[{"role": "user", "content": "Hello!"}]
      )
      print(response.choices[0].message.content)
      ```

      ```typescript Node.js (OpenAI SDK) theme={null}
      import OpenAI from "openai";

      const client = new OpenAI({
        baseURL: "https://gateway.metrixllm.com/openai/v1",
        apiKey: "mtx_...", // Your MetrixLLM API key
      });

      const response = await client.chat.completions.create({
        model: "gpt-4o",
        messages: [{ role: "user", content: "Hello!" }],
      });
      console.log(response.choices[0].message.content);
      ```

      ```python Python (Anthropic SDK) theme={null}
      from anthropic import Anthropic

      client = Anthropic(
          base_url="https://gateway.metrixllm.com/anthropic",
          api_key="mtx_..."
      )

      message = client.messages.create(
          model="claude-opus-4-5",
          max_tokens=1024,
          messages=[{"role": "user", "content": "Hello!"}]
      )
      print(message.content[0].text)
      ```

      ```typescript Node.js (Anthropic SDK) theme={null}
      import Anthropic from "@anthropic-ai/sdk";

      const client = new Anthropic({
        baseURL: "https://gateway.metrixllm.com/anthropic",
        apiKey: "mtx_...",
      });

      const message = await client.messages.create({
        model: "claude-opus-4-5",
        max_tokens: 1024,
        messages: [{ role: "user", content: "Hello!" }],
      });
      console.log(message.content[0].text);
      ```

      ```bash cURL theme={null}
      curl https://gateway.metrixllm.com/openai/v1/chat/completions \
        -H "Authorization: Bearer mtx_..." \
        -H "Content-Type: application/json" \
        -d '{
          "model": "gpt-4o",
          "messages": [{"role": "user", "content": "Hello!"}]
        }'
      ```

      ```rust Rust (reqwest) theme={null}
      use reqwest::Client;
      use serde_json::json;

      #[tokio::main]
      async fn main() -> Result<(), Box<dyn std::error::Error>> {
          let client = Client::new();
          let res = client
              .post("https://gateway.metrixllm.com/openai/v1/chat/completions")
              .bearer_auth("mtx_...")
              .json(&json!({
                  "model": "gpt-4o",
                  "messages": [{"role": "user", "content": "Hello!"}]
              }))
              .send()
              .await?;
          println!("{}", res.text().await?);
          Ok(())
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="Verify in the dashboard">
    Run your code. Then open the **Request Logs** page in your MetrixLLM dashboard.

    Your request will appear instantly with the full breakdown: provider, model, token count, cost, and latency.

    <Card title="Explore Request Logs →" icon="list" href="/dashboard/request-logs">
      Learn how to filter, inspect, and debug requests in the dashboard.
    </Card>
  </Step>
</Steps>

## Next steps

<CardGroup cols={3}>
  <Card title="Routing & Fallbacks" icon="arrow-right-arrow-left" href="/docs/routing">
    Configure automatic provider failover
  </Card>

  <Card title="Guardrails" icon="shield" href="/docs/guardrails">
    Add content safety rules
  </Card>

  <Card title="Cost Analytics" icon="chart-line" href="/docs/cost-analytics">
    Monitor and attribute spend
  </Card>
</CardGroup>
