Skip to content

Auto sync pricing #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/sync-models.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Sync Models

on:
schedule:
# Run daily at 8 AM PST (4 PM UTC in standard time, 3 PM UTC in daylight time)
# Using 4 PM UTC to cover PST year-round
- cron: "0 16 * * *"
workflow_dispatch: # Allow manual triggering
pull_request: # TODO: removeme

jobs:
sync-models:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install

- name: Run model sync
id: sync-models
run: |
npx tsx packages/proxy/scripts/sync_models.ts update-models --write | tee sync_output.txt
echo "sync_output<<EOF" >> $GITHUB_OUTPUT
cat sync_output.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Get current branch name
id: branch-name
run: |
BRANCH_NAME=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse HEAD)
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT

- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT

- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
[BOT] Synchronize model pricing and configurations
title: "chore[BOT]: Synchronize model pricing and configurations"
body: |
## sync-models.ts output
```
${{ steps.sync-models.outputs.sync_output }}
```
branch: sync-models-${{ github.run_id }}
base: ${{ steps.branch-name.outputs.branch_name }}
delete-branch: true
reviewers: |
ankrgyl
ibolmo
choochootrain
2 changes: 1 addition & 1 deletion packages/proxy/schema/model_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"format": "openai",
"flavor": "chat",
"multimodal": true,
"input_cost_per_mil_tokens": 2,
"input_cost_per_mil_tokens": 10,
"output_cost_per_mil_tokens": 8,
"input_cache_read_cost_per_mil_tokens": 0.5,
"reasoning": true,
Expand Down
Loading