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

# Quick Start

> Start routing AI traffic through Lectr in under 2 minutes.

## Overview

Lectr is a proxy that sits between your application and your AI provider.

Change one line — the `baseURL` — and Lectr begins capturing metadata for every AI request your product makes: latency, tokens, cost, and errors.

No SDK to install. No agent to run. No infrastructure changes.

***

## Step 1: Get your org key

Sign in at [app.lectr.ai](https://app.lectr.ai) and copy your org key from the dashboard.

Your key looks like this:

```
lc_key_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

<Warning>
  Your org key controls access to your Lectr data. Treat it like a password —
  store it in an environment variable and never hardcode it.
</Warning>

***

## Step 2: Point your client at Lectr

Replace your provider's base URL with `https://proxy.lectr.ai/v1` and add your org key as a header.

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

  const client = new OpenAI({
    apiKey: process.env.OPENAI_API_KEY,
    baseURL: "https://proxy.lectr.ai/v1",
    defaultHeaders: {
      "X-Lectr-Key": process.env.LECTR_KEY,
    },
  });
  ```

  ```python Python (OpenAI) theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["OPENAI_API_KEY"],
      base_url="https://proxy.lectr.ai/v1",
      default_headers={
          "X-Lectr-Key": os.environ["LECTR_KEY"],
      },
  )
  ```

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

  const client = new Anthropic({
    apiKey: process.env.ANTHROPIC_API_KEY,
    baseURL: "https://proxy.lectr.ai/v1",
    defaultHeaders: {
      "X-Lectr-Key": process.env.LECTR_KEY,
    },
  });
  ```

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

  client = Anthropic(
      api_key=os.environ["ANTHROPIC_API_KEY"],
      base_url="https://proxy.lectr.ai/v1",
      default_headers={
          "X-Lectr-Key": os.environ["LECTR_KEY"],
      },
  )
  ```
</CodeGroup>

Your application now sends AI requests through Lectr.

***

## Step 3: Send a request

Make any AI request as you normally would:

<CodeGroup>
  ```typescript Node.js theme={null}
  const response = await client.chat.completions.create({
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: "Hello" }],
  });

  console.log(response.choices[0].message.content);
  ```

  ```python Python theme={null}
  response = client.chat.completions.create(
      model="gpt-4o-mini",
      messages=[{"role": "user", "content": "Hello"}],
  )

  print(response.choices[0].message.content)
  ```
</CodeGroup>

Open your dashboard at [app.lectr.ai](https://app.lectr.ai)

Within a few seconds you should see the request appear with:

* model used
* latency
* token usage
* cost

Your first request is now flowing through Lectr.

***

## Optional: Test with `curl`

```bash theme={null}
curl https://proxy.lectr.ai/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "X-Lectr-Key: $LECTR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role":"user","content":"Hello"}]
  }'
```

***

## Step 4: Tag your features (recommended)

Add the `X-Lectr-Feature` header to tell Lectr which part of your product made each request. This unlocks per-feature cost tracking, latency breakdowns, and model recommendations.

<CodeGroup>
  ```typescript Node.js theme={null}
  const client = new OpenAI({
    apiKey: process.env.OPENAI_API_KEY,
    baseURL: "https://proxy.lectr.ai/v1",
    defaultHeaders: {
      "X-Lectr-Key": process.env.LECTR_KEY,
      "X-Lectr-Feature": "chat", // name of the feature making this request
    },
  });
  ```

  ```python Python theme={null}
  client = OpenAI(
      api_key=os.environ["OPENAI_API_KEY"],
      base_url="https://proxy.lectr.ai/v1",
      default_headers={
          "X-Lectr-Key": os.environ["LECTR_KEY"],
          "X-Lectr-Feature": "chat",  # name of the feature making this request
      },
  )
  ```
</CodeGroup>

Use a different client instance per feature, or override the header per request:

```typescript theme={null}
// Per-request override
const response = await client.chat.completions.create(
  {
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: "Summarise this document." }],
  },
  {
    headers: { "X-Lectr-Feature": "summariser" },
  },
);
```

<Tip>
  Good feature names are short and match what you'd call the feature in
  conversation — `chat`, `summariser`, `classifier`, `onboarding-assistant`.
  Avoid generic names like `api` or `backend`.
</Tip>

***

## Environment variables

We recommend storing your keys as environment variables:

```bash .env theme={null}
OPENAI_API_KEY=sk-...
LECTR_KEY=lc_key_...
```

***

## What happens to your API key?

Your provider API key passes through Lectr **in memory only** and is forwarded directly to the provider.

Lectr never stores, logs, or persists your API keys.

See [Security & Trust](/security) for the full details.

***

## Supported providers

Lectr supports any OpenAI-compatible provider through the same endpoint:

| Provider      | Detection                        | Notes                                 |
| ------------- | -------------------------------- | ------------------------------------- |
| OpenAI        | Automatic                        | All models supported                  |
| Anthropic     | Automatic                        | Via OpenAI-compatible endpoint        |
| Groq          | Automatic                        | Via OpenAI-compatible endpoint        |
| Google Gemini | Automatic                        | Via OpenAI-compatible endpoint        |
| Azure OpenAI  | `X-Lectr-Provider: azure` header | Requires endpoint config in dashboard |

Lectr detects the provider automatically from the model name. Use `X-Lectr-Provider` to override when needed.

***

## Next steps

<CardGroup cols={2}>
  <Card title="Feature Tagging" icon="tag" href="/guides/feature-tagging">
    Break down cost and latency by feature across your product.
  </Card>

  <Card title="Task Types" icon="list" href="/guides/task-types">
    Declare task type to unlock smarter model recommendations.
  </Card>

  <Card title="Routing Rules" icon="shuffle" href="/guides/routing-rules">
    Automatically route requests to the right model based on feature or task.
  </Card>

  <Card title="Multi-Provider" icon="globe" href="/guides/multi-provider-setup">
    Route traffic across OpenAI, Anthropic, Groq, and Gemini from one proxy.
  </Card>
</CardGroup>
