Skip to content
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
89 changes: 89 additions & 0 deletions .github/workflows/sync-models.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
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:
- uses: actions/create-github-app-token@v1
id: bot-token
with:
app-id: ${{ secrets.GH_BOT_APP_ID }}
private-key: ${{ secrets.GH_BOT_APP_PRIVATE_KEY }}

- name: Checkout repository
uses: actions/checkout@v4

- 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 release branch and update VERSION file
if: steps.git-check.outputs.changes == 'true'
id: create_branch
run: |
set -e # Exit on any error

git checkout -b "sync-models-${{ github.run_id }}"
echo "${{ steps.new_version.outputs.new_version }}" > VERSION
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION
git commit -m "Propose release ${{ steps.new_version.outputs.new_version }}"
git push -f origin "$NEW_BRANCH"
echo "BRANCH_NAME=$NEW_BRANCH" >> "$GITHUB_ENV"

- 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 @@ -289,7 +289,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