Skip to content

Support GitHub Models inference provider #189

@sgoedecke

Description

@sgoedecke

GitHub Models provides free AI inference in GitHub Models (supports all OpenAI models, DeepSeek, plus others). It would be nice to support that in the GitHub Actions version of this project, so users don't need to generate an OpenAI key.

Here's an example (uses built-in GITHUB_TOKEN):

name: Code Review

permissions:
  contents: read
  pull-requests: write
  models: read # Required to call GitHub Models

on:
  pull_request:
    types: [opened, reopened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: anc95/ChatGPT-CodeReview@main
        env:
          # Required for the action itself to access the PR
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          # Use GitHub Models for inference
          OPENAI_API_KEY: ${{ secrets.GITHUB_TOKEN }}
          OPENAI_API_ENDPOINT: https://models.github.ai/inference
          MODEL: gpt-4o-mini
          # Optional tuning
          LANGUAGE: English
          PROMPT: # example: Please check if there are any confusions or irregularities in the following code diff:
          top_p: 1
          temperature: 1
          max_tokens: 10000
          MAX_PATCH_LENGTH: 10000
          IGNORE_PATTERNS: /node_modules/**/*,*.md
          INCLUDE_PATTERNS: *.js,*.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions