Skip to content

added auto-update command#283

Open
atsaplin wants to merge 1 commit intopydantic:mainfrom
atsaplin:auto-update-command
Open

added auto-update command#283
atsaplin wants to merge 1 commit intopydantic:mainfrom
atsaplin:auto-update-command

Conversation

@atsaplin
Copy link
Copy Markdown
Contributor

@atsaplin atsaplin commented Feb 11, 2026

Summary

  • Add non-interactive auto-update system that detects missing model IDs from
    external price sources (OpenRouter, LiteLLM, Simon Willison), classifies them as
    auto-resolvable aliases or models needing human review, and applies safe changes to
    provider YAML files
  • Add scripts/auto-update.sh orchestrator script
    automate the full flow (fetch prices, detect, apply, format, build, open PR). This can be called by a auto-scheduled github action later (if desired)
  • Add 40 unit tests covering name matching, price matching, classification logic,
    and routing path filtering

How it works

When providers release new models (e.g. gpt-5.2-chat-latest), external sources
pick up the new slug before this repo does. The auto-update system:

  1. Detects missing model IDs across all providers and sources
  2. Classifies each as auto-resolvable (exact/subset price match + name prefix
    match) or needing human review
  3. Applies safe aliases to provider YAMLs, including dot/dash variants
    (gpt-5.2gpt-5-2)
  4. Filters noise: LiteLLM routing paths (openrouter/meta-llama/...), Bedrock
    ARN-style IDs (us.anthropic.claude-...)

The Python CLI (uv run -m prices auto_update) outputs a JSON report only — zero
side effects. All file mutations, formatting, building, and PR creation are handled
by the shell script.

Github Action

Seperately to this PR, you can add a github action to execute this at a specific cadence .

Example:

name: Auto-Update Prices
on:
  schedule:
    - cron: "0 8 * * 1" # Weekly Monday 08:00 UTC
  workflow_dispatch: {} # Manual trigger

permissions:
  contents: write
  pull-requests: write

jobs:
  auto-update:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          repository: atsaplin/genai-prices

      - uses: astral-sh/setup-uv@v6

      - run: uv sync --frozen --all-packages

      - name: Run auto-update and open PR
        run: ./scripts/auto-update.sh --pr
        env:
          GH_TOKEN: ${{ github.token }}

Files

File Description
prices/src/prices/auto_update.py Core detection/classification/apply logic
prices/src/prices/__main__.py Register auto_update CLI command
scripts/auto-update.sh Orchestrator: fetch, detect, apply, format, build, PR

|
| .github/workflows/auto-update-prices.yml | Weekly scheduled Action (Monday
08:00 UTC) |
| Makefile | auto-update target |
| tests/test_auto_update.py | 40 unit tests |

Test plan

  • make test — 379 tests pass (40 new + 339 existing)
  • End-to-end local run: detects 8 aliases, applies to 5 providers
  • No temp file artifacts left on disk (mktemp + trap cleanup)
  • jq PR body generation renders clean markdown

@atsaplin atsaplin force-pushed the auto-update-command branch 4 times, most recently from db8b71b to 6db6194 Compare February 11, 2026 22:27
@atsaplin atsaplin force-pushed the auto-update-command branch from 6db6194 to aa1fba6 Compare February 11, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant