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

# Quickstart

> Send your first AI transaction to Fenra in under 5 minutes

Get Fenra tracking your AI costs in three steps.

<Steps>
  <Step title="Get Your API Key">
    Sign in to [app.fenra.io](https://app.fenra.io) and navigate to **Settings → API Keys**. Click **Create New Key**, give it a name, and copy the key.
  </Step>

  <Step title="Send a Test Transaction">
    After your next AI provider call, send the usage data to Fenra:

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST 'https://ingest.fenra.io/usage/transactions' \
        -H 'Content-Type: application/json' \
        -H 'X-Api-Key: YOUR_API_KEY' \
        -d '{
          "provider": "openai",
          "model": "gpt-4o",
          "usage": [{
            "type": "tokens",
            "metrics": {
              "input_tokens": 150,
              "output_tokens": 50,
              "total_tokens": 200
            }
          }],
          "context": {
            "billable_customer_id": "my-company"
          }
        }'
      ```

      ```javascript Node.js theme={null}
      // After your OpenAI call
      const response = await openai.chat.completions.create({
        model: "gpt-4o",
        messages: [{ role: "user", content: "Hello!" }]
      });

      // Send to Fenra
      await fetch('https://ingest.fenra.io/usage/transactions', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'X-Api-Key': process.env.FENRA_API_KEY
        },
        body: JSON.stringify({
          provider: 'openai',
          model: response.model,
          usage: [{
            type: 'tokens',
            metrics: {
              input_tokens: response.usage.prompt_tokens,
              output_tokens: response.usage.completion_tokens,
              total_tokens: response.usage.total_tokens
            }
          }],
          context: {
            billable_customer_id: 'my-company'
          }
        })
      });
      ```

      ```python Python theme={null}
      import requests
      import os

      # After your OpenAI call
      response = client.chat.completions.create(
          model="gpt-4o",
          messages=[{"role": "user", "content": "Hello!"}]
      )

      # Send to Fenra
      requests.post(
          'https://ingest.fenra.io/usage/transactions',
          headers={
              'Content-Type': 'application/json',
              'X-Api-Key': os.getenv('FENRA_API_KEY')
          },
          json={
              'provider': 'openai',
              'model': response.model,
              'usage': [{
                  'type': 'tokens',
                  'metrics': {
                      'input_tokens': response.usage.prompt_tokens,
                      'output_tokens': response.usage.completion_tokens,
                      'total_tokens': response.usage.total_tokens
                  }
              }],
              'context': {
                  'billable_customer_id': 'my-company'
              }
          }
      )
      ```
    </CodeGroup>

    A successful response returns `202 Accepted`:

    ```json theme={null}
    {
      "status": "queued",
      "events_queued": 1,
      "message": "1 transaction(s) queued for processing"
    }
    ```
  </Step>

  <Step title="See It in Your Dashboard">
    Head back to [app.fenra.io](https://app.fenra.io). Your transaction appears in the dashboard within seconds, with costs automatically calculated.
  </Step>
</Steps>

## Transaction Schema

Every transaction needs:

| Field                          | Required | Description                                                                             |
| ------------------------------ | -------- | --------------------------------------------------------------------------------------- |
| `provider`                     | Yes      | `openai`, `anthropic`, `gemini`, `bedrock`, `xai`, `deepseek`, or `custom`              |
| `model`                        | Yes      | Model identifier (e.g., `gpt-4o`, `claude-3-5-sonnet-20241022`)                         |
| `usage`                        | Yes      | What resources the AI call consumed: tokens for text, images for image generation, etc. |
| `context.billable_customer_id` | Yes      | Required identifier for billing/grouping                                                |

## Context

The `context` object only requires `billable_customer_id`. You can add any other fields you want. They will appear in your dashboard and can be used for filtering, alerts, and reports.

See the [Transactions Guide](/guides/transactions) for examples of useful context fields.

## Next Steps

<CardGroup cols={2}>
  <Card title="Transactions Guide" icon="book" href="/guides/transactions">
    Learn about context fields and usage types.
  </Card>

  <Card title="Set Up Alerts" icon="bell" href="/guides/alerts">
    Get notified when spending exceeds your thresholds.
  </Card>
</CardGroup>
