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

# Ingestion Blueprints

> Ready-made event ingestion patterns for common use cases with sample code.

Ingestion blueprints are pre-built patterns for tracking usage in common scenarios. Instead of figuring out event structures and meter configurations from scratch, start with a proven blueprint and customize it for your needs.

## What Are Blueprints?

Each blueprint includes:

* **Event structure recommendations**: Optimal event naming and metadata design
* **Meter configuration**: Suggested aggregation types and filters
* **Sample code**: Working implementation examples in multiple languages
* **Best practices**: Tips for accuracy, performance, and cost optimization

<Tip>
  Blueprints save hours of setup time and help you avoid common pitfalls. Start with a blueprint, then adapt it to your specific requirements.
</Tip>

## Why Use Blueprints?

<CardGroup cols={3}>
  <Card title="Faster Setup" icon="rocket">
    Get usage tracking working in minutes instead of hours. Copy proven patterns instead of designing from scratch.
  </Card>

  <Card title="Best Practices Built In" icon="shield-check">
    Avoid common mistakes with tested event structures, proper metadata, and optimal aggregation choices.
  </Card>

  <Card title="Production Ready" icon="code">
    Sample code is based on real-world implementations. Just add your API keys and go.
  </Card>
</CardGroup>

## Available Blueprints

Choose the blueprint that matches your use case:

<CardGroup cols={1}>
  <Card title="LLM Blueprint" icon="brain-circuit" href="/developer-resources/ingestion-blueprints/llm">
    Track AI token usage across OpenAI, Anthropic, Groq, Gemini, Vercel AI SDK, and more.

    **Perfect for**: AI chatbots, code generators, content creation tools, AI-powered apps.

    **What you'll track**: Input tokens, output tokens, model usage, request counts.
  </Card>

  <Card title="API Gateway Blueprint" icon="cloud" href="/developer-resources/ingestion-blueprints/api-gateway">
    Meter API requests at the gateway level with endpoint filtering and rate limiting support.

    **Perfect for**: REST APIs, GraphQL services, webhook providers, API-first platforms.

    **What you'll track**: Request counts, endpoint usage, HTTP methods, response times.
  </Card>

  <Card title="Object Storage Blueprint" icon="box-archive" href="/developer-resources/ingestion-blueprints/object-storage">
    Track file uploads, storage consumption, and bandwidth for cloud storage services.

    **Perfect for**: File hosting, media platforms, backup services, document management.

    **What you'll track**: Bytes stored, file uploads, downloads, storage snapshots.
  </Card>

  <Card title="Stream Blueprint" icon="tower-broadcast" href="/developer-resources/ingestion-blueprints/stream">
    Measure streaming bandwidth for video, audio, and real-time data delivery.

    **Perfect for**: Video streaming, audio platforms, live broadcasts, real-time data feeds.

    **What you'll track**: Bandwidth consumed, stream duration, quality levels, concurrent streams.
  </Card>

  <Card title="Time Range Blueprint" icon="clock" href="/developer-resources/ingestion-blueprints/time-range">
    Bill by elapsed time for compute resources, serverless functions, and long-running jobs.

    **Perfect for**: Serverless platforms, container hosting, compute instances, batch processing.

    **What you'll track**: Execution time, compute hours, function invocations, job duration.
  </Card>
</CardGroup>

## How to Use a Blueprint

<Steps>
  <Step title="Choose your blueprint">
    Select the blueprint that best matches your billing scenario. Each blueprint page includes detailed implementation guides.
  </Step>

  <Step title="Review the event structure">
    Understand the recommended event naming and metadata design. Copy the event structure for your use case.
  </Step>

  <Step title="Create the meter">
    Follow the blueprint's meter configuration instructions. Use the suggested aggregation type and filters.
  </Step>

  <Step title="Implement event sending">
    Copy the sample code for your language/framework. Replace placeholder values with your actual API keys and customer IDs.
  </Step>

  <Step title="Test and verify">
    Send test events and verify they appear in your meter dashboard with correct aggregation.
  </Step>

  <Step title="Customize as needed">
    Adapt the blueprint to your specific requirements—add custom metadata, adjust filters, or modify pricing.
  </Step>
</Steps>

## Blueprint Comparison

Not sure which blueprint fits your needs? Here's a quick comparison:

| Use Case       | Blueprint      | Aggregation     | Common Metadata                      |
| -------------- | -------------- | --------------- | ------------------------------------ |
| AI chat app    | LLM            | Sum (tokens)    | model, input\_tokens, output\_tokens |
| REST API       | API Gateway    | Count           | endpoint, method, status\_code       |
| File storage   | Object Storage | Sum (bytes)     | file\_size, file\_type, operation    |
| Video platform | Stream         | Sum (bandwidth) | duration, quality, bitrate           |
| Serverless     | Time Range     | Sum (duration)  | function\_name, execution\_time\_ms  |

## Custom Implementations

Don't see a blueprint for your exact use case? No problem:

1. **Start with the closest blueprint**: Pick the one most similar to your needs
2. **Adapt the event structure**: Modify metadata fields to match your requirements
3. **Adjust meter configuration**: Change aggregation type or filters as needed
4. **Test thoroughly**: Verify billing calculations with sample usage

<Info>
  All blueprints are starting points. Feel free to mix concepts from different blueprints or create entirely custom implementations.
</Info>

## Need Help?

If you're unsure which blueprint to use or need help customizing:

<CardGroup cols={2}>
  <Card title="Complete Tutorial" icon="code" href="/developer-resources/usage-based-billing-build-ai-image-generator">
    Follow our end-to-end tutorial building an AI image generator with usage billing.
  </Card>

  <Card title="Integration Guide" icon="book" href="/developer-resources/usage-based-billing-guide">
    Comprehensive guide covering all aspects of usage-based billing implementation.
  </Card>
</CardGroup>
