# rashmi0405/ai-model-tracker architecture

> Architecture diagram of the GitHub repository rashmi0405/ai-model-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rashmi0405/ai-model-tracker
- Repository: https://github.com/rashmi0405/ai-model-tracker

## Overview

AI Model Price Tracker is a daily ELT pipeline that captures OpenRouter model data, preserves raw snapshots, transforms them into price history and analytics tables, and serves those marts to a Looker Studio dashboard. Airflow orders extraction, loading, freshness checks, and dbt builds. The tree contains no snapshot configuration or dashboard implementation, so those capabilities are represented from the README with no source path; transformation relationships use documented architecture rather than unsampled SQL details.

Main entry points: [`ai_model_tracker_dag.py`](https://github.com/rashmi0405/ai-model-tracker/blob/main/ai_model_tracker_dag.py) (Daily Airflow DAG), [`stg_openrouter__models.sql`](https://github.com/rashmi0405/ai-model-tracker/blob/main/stg_openrouter__models.sql) (Typed staging view), [`int_openrouter__latest_models.sql`](https://github.com/rashmi0405/ai-model-tracker/blob/main/int_openrouter__latest_models.sql) (Latest models view), [`extract_models.py`](https://github.com/rashmi0405/ai-model-tracker/blob/main/extract_models.py) (Snapshot extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_schedule["Scheduling"]
  node_airflow["Daily Airflow DAG"]
end

subgraph group_ingest["Data ingestion"]
  node_extract["Snapshot extraction<br/>[extract_models.py]"]
  node_gcs[("Raw Cloud Storage")]
  node_loader["BigQuery loader"]
  node_raw[("BigQuery raw table")]
end

subgraph group_transform["dbt transformations"]
  node_freshness["Source freshness check<br/>[sources.yml]"]
  node_staging["Typed staging view"]
  node_latest["Latest models view"]
  node_history[("SCD Type 2 history")]
  node_dimension["Model dimension<br/>[dim_models.sql]"]
  node_daily_prices["Daily price fact"]
  node_price_changes["Price change fact"]
  node_provider_summary["Provider daily aggregate"]
end

subgraph group_serve["Analytics serving"]
  node_dashboard["Looker Studio dashboard"]
end

node_openrouter(("OpenRouter API"))

node_airflow -->|"runs task"| node_extract
node_airflow -->|"runs task"| node_loader
node_airflow -->|"runs check"| node_freshness
node_airflow -->|"runs dbt build"| node_staging
node_openrouter -->|"provides models"| node_extract
node_extract -->|"writes snapshot"| node_gcs
node_gcs -->|"supplies snapshot"| node_loader
node_loader -->|"loads rows"| node_raw
node_raw -->|"checks freshness"| node_freshness
node_raw -->|"transforms raw data"| node_staging
node_staging -->|"selects latest day"| node_latest
node_staging -->|"tracks price versions"| node_history
node_latest -->|"builds marts"| node_dimension
node_history -->|"builds daily fact"| node_daily_prices
node_history -->|"derives changes"| node_price_changes
node_latest -->|"builds aggregate"| node_provider_summary
node_dimension -->|"serves mart tables"| node_dashboard
node_daily_prices -->|"serves mart tables"| node_dashboard
node_price_changes -->|"serves mart tables"| node_dashboard
node_provider_summary -->|"serves mart tables"| node_dashboard

click node_airflow "https://github.com/rashmi0405/ai-model-tracker/blob/main/ai_model_tracker_dag.py"
click node_extract "https://github.com/rashmi0405/ai-model-tracker/blob/main/extract_models.py"
click node_loader "https://github.com/rashmi0405/ai-model-tracker/blob/main/load_to_bigquery.py"
click node_freshness "https://github.com/rashmi0405/ai-model-tracker/blob/main/sources.yml"
click node_staging "https://github.com/rashmi0405/ai-model-tracker/blob/main/stg_openrouter__models.sql"
click node_latest "https://github.com/rashmi0405/ai-model-tracker/blob/main/int_openrouter__latest_models.sql"
click node_dimension "https://github.com/rashmi0405/ai-model-tracker/blob/main/dim_models.sql"
click node_daily_prices "https://github.com/rashmi0405/ai-model-tracker/blob/main/fct_model_daily_prices.sql"
click node_price_changes "https://github.com/rashmi0405/ai-model-tracker/blob/main/fct_model_price_changes.sql"
click node_provider_summary "https://github.com/rashmi0405/ai-model-tracker/blob/main/agg_provider_daily_summary.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_airflow toneBlue
class node_extract,node_gcs,node_loader,node_raw toneAmber
class node_freshness,node_staging,node_latest,node_history,node_dimension,node_daily_prices,node_price_changes,node_provider_summary,node_openrouter toneMint
class node_dashboard toneRose
```

## Components

### Scheduling

- [Daily Airflow DAG](https://github.com/rashmi0405/ai-model-tracker/blob/main/ai_model_tracker_dag.py): `ai_model_tracker_dag.py`

### Data ingestion

- [Snapshot extraction](https://github.com/rashmi0405/ai-model-tracker/blob/main/extract_models.py): `extract_models.py`
- **Raw Cloud Storage**
- [BigQuery loader](https://github.com/rashmi0405/ai-model-tracker/blob/main/load_to_bigquery.py): `load_to_bigquery.py`
- **BigQuery raw table**

### dbt transformations

- [Source freshness check](https://github.com/rashmi0405/ai-model-tracker/blob/main/sources.yml): `sources.yml`
- [Typed staging view](https://github.com/rashmi0405/ai-model-tracker/blob/main/stg_openrouter__models.sql): `stg_openrouter__models.sql`
- [Latest models view](https://github.com/rashmi0405/ai-model-tracker/blob/main/int_openrouter__latest_models.sql): `int_openrouter__latest_models.sql`
- **SCD Type 2 history**
- [Model dimension](https://github.com/rashmi0405/ai-model-tracker/blob/main/dim_models.sql): `dim_models.sql`
- [Daily price fact](https://github.com/rashmi0405/ai-model-tracker/blob/main/fct_model_daily_prices.sql): `fct_model_daily_prices.sql`
- [Price change fact](https://github.com/rashmi0405/ai-model-tracker/blob/main/fct_model_price_changes.sql): `fct_model_price_changes.sql`
- [Provider daily aggregate](https://github.com/rashmi0405/ai-model-tracker/blob/main/agg_provider_daily_summary.sql): `agg_provider_daily_summary.sql`

### Analytics serving

- **Looker Studio dashboard**

### Other components

- **OpenRouter API**

## Connections

- Daily Airflow DAG → Snapshot extraction: runs task (evidence: `ai_model_tracker_dag.py`)
- Daily Airflow DAG → BigQuery loader: runs task (evidence: `ai_model_tracker_dag.py`)
- Daily Airflow DAG → Source freshness check: runs check (evidence: `ai_model_tracker_dag.py`)
- Daily Airflow DAG → Typed staging view: runs dbt build (evidence: `ai_model_tracker_dag.py`)
- OpenRouter API → Snapshot extraction: provides models (evidence: `extract_models.py`)
- Snapshot extraction → Raw Cloud Storage: writes snapshot (evidence: `extract_models.py`)
- Raw Cloud Storage → BigQuery loader: supplies snapshot (evidence: `load_to_bigquery.py`)
- BigQuery loader → BigQuery raw table: loads rows (evidence: `load_to_bigquery.py`)
- BigQuery raw table → Source freshness check: checks freshness (evidence: `README.md`)
- BigQuery raw table → Typed staging view: transforms raw data (evidence: `README.md`)
- Typed staging view → Latest models view: selects latest day (evidence: `README.md`)
- Typed staging view → SCD Type 2 history: tracks price versions (evidence: `README.md`)
- Latest models view → Model dimension: builds marts (evidence: `README.md`)
- SCD Type 2 history → Daily price fact: builds daily fact (evidence: `README.md`)
- SCD Type 2 history → Price change fact: derives changes (evidence: `README.md`)
- Latest models view → Provider daily aggregate: builds aggregate (evidence: `README.md`)
- Model dimension → Looker Studio dashboard: serves mart tables (evidence: `README.md`)
- Daily price fact → Looker Studio dashboard: serves mart tables (evidence: `README.md`)
- Price change fact → Looker Studio dashboard: serves mart tables (evidence: `README.md`)
- Provider daily aggregate → Looker Studio dashboard: serves mart tables (evidence: `README.md`)
