diff --git a/.github/workflows/sync-models.yaml b/.github/workflows/sync-models.yaml new file mode 100644 index 00000000..8131205d --- /dev/null +++ b/.github/workflows/sync-models.yaml @@ -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<> $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 diff --git a/packages/proxy/schema/model_list.json b/packages/proxy/schema/model_list.json index 65c0d99d..20257546 100644 --- a/packages/proxy/schema/model_list.json +++ b/packages/proxy/schema/model_list.json @@ -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,