# GitHub Models

The [GitHub Models](https://github.com/marketplace/models) provider, `github`, allows running models through the GitHub Marketplace. This provider is useful for prototyping and subject to [rate limits](https://docs.github.com/en/github-models/prototyping-with-ai-models#rate-limits) depending on your subscription.

```js
script({ model: "github:openai/gpt-4o" });
```

### Codespace configuration

[Section titled “Codespace configuration”](#codespace-configuration)

If you are running from a [GitHub Codespace](https://github.com/features/codespaces), the token is already configured for you… It just works.

### GitHub Actions configuration

[Section titled “GitHub Actions configuration”](#github-actions-configuration)

As of [April 2025](https://github.blog/changelog/2025-04-14-github-actions-token-integration-now-generally-available-in-github-models/), you can use the GitHub Actions token (`GITHUB_TOKEN`) to call AI models directly inside your workflows.

1. Ensure that the `models` permission is enabled in your workflow configuration.

   genai.yml

   ```yaml
   permissions:
     models: read
   ```

2. Pass the `GITHUB_TOKEN` when running `genaiscript`

   genai.yml

   ```yaml
   run: npx -y genaiscript run ...
   env:
     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   ```

Read more in the [GitHub Documentation](https://docs.github.com/en/github-models/integrating-ai-models-into-your-development-workflow#using-ai-models-with-github-actions)

### Configuring with your own token

[Section titled “Configuring with your own token”](#configuring-with-your-own-token)

If you are not using GitHub Actions or Codespaces, you can use your own token to access the models.

1. Create a [GitHub personal access token](https://github.com/settings/tokens/new). The token should not have any scopes or permissions.

2. Update the `.env` file with the token.

   .env

   ```txt
   GITHUB_TOKEN=...
   ```

To configure a specific model,

1. Open the [GitHub Marketplace](https://github.com/marketplace/models) and find the model you want to use.

2. Copy the model name from the Javascript/Python samples

   ```js
   const modelName = "microsoft/Phi-3-mini-4k-instruct";
   ```

   to configure your script.

   ```js
   script({
     model: "github:microsoft/Phi-3-mini-4k-instruct",
   });
   ```

If you are already using `GITHUB_TOKEN` variable in your script and need a different one for GitHub Models, you can use the `GITHUB_MODELS_TOKEN` variable instead.

### GitHub CLI authentication

[Section titled “GitHub CLI authentication”](#github-cli-authentication)

If you don’t have environment variables configured, GenAIScript will attempt to use the GitHub CLI (`gh`) to retrieve your authentication token.

1. Install the GitHub CLI from <https://cli.github.com/> and ensure it’s available in your PATH.

2. Authenticate with GitHub using the CLI:

   ```bash
   gh auth login
   ```

This approach is convenient for local development but requires that you have the GitHub CLI installed and authenticated.

### Organization Inference Point

[Section titled “Organization Inference Point”](#organization-inference-point)

By default, GitHub Models uses the current actor to run inference. You can specify an organization in the `GITHUB_MODELS_ORG` environment to run inference on behalf of that organization instead.

.env

```txt
GITHUB_MODELS_ORG=my-org
```

The actor must be a member of the organization and have enabled models in the organization (see [documentation](https://docs.github.com/en/rest/models/embeddings#run-an-embedding-request-attributed-to-an-organization)).

### `o1-preview` and `o1-mini` models

[Section titled “o1-preview and o1-mini models”](#o1-preview-and-o1-mini-models)

Currently these models do not support streaming and system prompts. GenAIScript handles this internally.

```js
script({
  model: "github:openai/o1-mini",
});
```

### Aliases

The following model aliases are attempted by default in GenAIScript.

| Alias            | Model identifier              |
| ---------------- | ----------------------------- |
| large            | openai/gpt-4.1                |
| small            | openai/gpt-4.1-mini           |
| tiny             | openai/gpt-4.1-nano           |
| vision           | openai/gpt-4.1                |
| reasoning        | openai/o3                     |
| reasoning\_small | openai/o3-mini                |
| embeddings       | openai/text-embedding-3-small |

### Limitations

* Smaller context windows, and rate limiting in free tier. See https\://docs.github.com/en/github-models/use-github-models/prototyping-with-ai-models.
* listModels
* logprobs (and top logprobs) ignored
* Ignore prediction of output tokens
* topLogprobs