Skip to content

github/gh-models

Repository files navigation

GitHub Models extension

Use the GitHub Models service from the CLI!

Using

Prerequisites

The extension requires the gh CLI to be installed and in the PATH. The extension also requires the user have authenticated via gh auth.

Installing

After installing the gh CLI, from a command-line run:

gh extension install https://github.com/github/gh-models

Upgrading

If you've previously installed the gh models extension and want to update to the latest version, you can run this command:

gh extension upgrade github/gh-models

Examples

Listing models

gh models list

Example output:

Name                          Friendly Name                 Publisher
AI21-Jamba-Instruct           AI21-Jamba-Instruct           AI21 Labs
gpt-4o                        OpenAI GPT-4o                 Azure OpenAI Service
gpt-4o-mini                   OpenAI GPT-4o mini            Azure OpenAI Service
Cohere-command-r              Cohere Command R              cohere
Cohere-command-r-plus         Cohere Command R+             cohere

Use the value in the "Name" column when specifying the model on the command-line.

Running inference

REPL mode

Run the extension in REPL mode. This will prompt you for which model to use.

gh models run

In REPL mode, use /help to list available commands. Otherwise just type your prompt and hit ENTER to send to the model.

Single-shot mode

Run the extension in single-shot mode. This will print the model output and exit.

gh models run gpt-4o-mini "why is the sky blue?"

Run the extension with output from a command. This uses single-shot mode.

cat README.md | gh models run gpt-4o-mini "summarize this text"

Notice

Remember when interacting with a model you are experimenting with AI, so content mistakes are possible. The feature is subject to various limits (including requests per minute, requests per day, tokens per request, and concurrent requests) and is not designed for production use cases. GitHub Models uses Azure AI Content Safety. These filters cannot be turned off as part of the GitHub Models experience. If you decide to employ models through a paid service, please configure your content filters to meet your requirements. This service is under GitHub's Pre-release Terms. Your use of the GitHub Models is subject to the following Product Terms and Privacy Statement. Content within this Repository may be subject to additional license terms.