> ## Documentation Index
> Fetch the complete documentation index at: https://chatcli.edilsonfreitas.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub Models (Marketplace)

> Access dozens of models from the GitHub Models marketplace directly in ChatCLI with your GitHub token.

ChatCLI supports **GitHub Models** as a native provider, giving you access to models like GPT-4o, Llama 3.1, DeepSeek R1, Mistral, Phi-4 and more directly from the [GitHub Models marketplace](https://github.com/marketplace/models).

***

## Why GitHub Models?

<CardGroup cols={2}>
  <Card title="No extra cost" icon="dollar-sign">
    Use models with your existing GitHub token. Free tier includes GPT-4o, Llama 3.1 405B/8B.
  </Card>

  <Card title="Model variety" icon="layer-group">
    Access models from OpenAI, Meta, Mistral, DeepSeek, Microsoft, Cohere and others.
  </Card>

  <Card title="Zero configuration" icon="bolt">
    If you already have `GITHUB_TOKEN` set (e.g. GitHub CLI), it works automatically.
  </Card>

  <Card title="Compatible API" icon="plug">
    Uses OpenAI-compatible API at `models.inference.ai.azure.com`.
  </Card>
</CardGroup>

***

## Setup

### Option 1: Environment Variable (Recommended)

If you already use GitHub CLI (`gh`) or have `GITHUB_TOKEN` configured, the provider is detected automatically:

```bash theme={"system"}
export GITHUB_TOKEN=ghp_your_token_here
# or
export GH_TOKEN=ghp_your_token_here
# or
export GITHUB_MODELS_TOKEN=ghp_your_token_here
```

Then select the provider:

```bash theme={"system"}
chatcli --provider github_models --model gpt-4o
```

Or inside ChatCLI:

```bash theme={"system"}
/switch --provider github_models --model gpt-4o
```

### Option 2: Interactive Login

```bash theme={"system"}
/auth login github-models
```

<Steps>
  <Step title="Generate a Personal Access Token (PAT)">
    Go to [github.com/settings/tokens](https://github.com/settings/tokens) and create a token. No special scopes are required for model inference.
  </Step>

  <Step title="Paste the token in the terminal">
    ChatCLI will prompt for the token. Paste it and press Enter.
  </Step>

  <Step title="Provider available immediately">
    The `GITHUB_MODELS` provider appears in `/switch` without restarting.
  </Step>
</Steps>

### Logout

```bash theme={"system"}
/auth logout github-models
```

***

## Available Models

Availability depends on your GitHub plan:

### Free Tier

| Model                          | Publisher    | Context Window |
| ------------------------------ | ------------ | -------------- |
| `gpt-4o`                       | Azure OpenAI | 128K           |
| `gpt-4o-mini`                  | Azure OpenAI | 128K           |
| `Meta-Llama-3.1-405B-Instruct` | Meta         | 128K           |
| `Meta-Llama-3.1-8B-Instruct`   | Meta         | 128K           |

### With GitHub Copilot Pro (additional models)

| Model                           | Publisher | Context Window |
| ------------------------------- | --------- | -------------- |
| `DeepSeek-R1`                   | DeepSeek  | 64K            |
| `Mistral-large-2411`            | Mistral   | 128K           |
| `Phi-4`                         | Microsoft | 16K            |
| `AI21-Jamba-1.5-Large`          | AI21      | 256K           |
| `Cohere-command-r-plus-08-2024` | Cohere    | 128K           |

<Info>
  The full list of models is at [github.com/marketplace/models](https://github.com/marketplace/models). Use `/switch --model` to see models available for your token.
</Info>

<Warning>
  Models not available for your plan return an `unavailable_model` error when you try to send a prompt. The `/switch --model` list includes both API models and catalog models — catalog models may not be available for your token.
</Warning>

***

## Model Listing

ChatCLI combines two sources when listing models:

1. **API** — models returned by the `/models` endpoint (actual token availability)
2. **Catalog** — known marketplace models (may require a higher plan)

```bash theme={"system"}
/switch --model
```

Models tagged with `[api]` were confirmed as available for your token.

***

## Environment Variables

| Variable                   | Description                                    | Default                                                  |
| -------------------------- | ---------------------------------------------- | -------------------------------------------------------- |
| `GITHUB_TOKEN`             | GitHub Personal Access Token (priority 1)      | -                                                        |
| `GH_TOKEN`                 | Alias for GitHub Token (priority 2)            | -                                                        |
| `GITHUB_MODELS_TOKEN`      | Dedicated token for GitHub Models (priority 3) | -                                                        |
| `GITHUB_MODELS_API_URL`    | API URL override                               | `https://models.inference.ai.azure.com/chat/completions` |
| `GITHUB_MODELS_MAX_TOKENS` | Max output tokens                              | `4096`                                                   |
| `GITHUB_MODELS_MODEL`      | Default model                                  | `gpt-4o`                                                 |

***

## Difference Between GitHub Models, Copilot and OpenAI

| Aspect       | GitHub Models                       | GitHub Copilot               | OpenAI (API Key)        |
| ------------ | ----------------------------------- | ---------------------------- | ----------------------- |
| **Auth**     | GitHub PAT (`ghp_...`)              | Device Flow OAuth            | API Key (`sk-...`)      |
| **Endpoint** | `models.inference.ai.azure.com`     | `api.githubcopilot.com`      | `api.openai.com`        |
| **Models**   | GPT-4o, Llama, Mistral, DeepSeek... | GPT-4o, Claude, Gemini       | All OpenAI models       |
| **Cost**     | Free (with rate limits)             | Copilot subscription         | Pay-per-use (billing)   |
| **Command**  | `/auth login github-models`         | `/auth login github-copilot` | `OPENAI_API_KEY=sk-...` |
| **Provider** | `GITHUB_MODELS`                     | `COPILOT`                    | `OPENAI`                |

<Tip>
  If you have a GitHub token but no paid OpenAI subscription, `GITHUB_MODELS` is the best option for free GPT-4o access.
</Tip>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="OAuth Authentication" icon="key" href="/features/oauth-authentication">
    Other authentication methods (Anthropic, OpenAI Codex, Copilot)
  </Card>

  <Card title="Provider Fallback" icon="arrows-rotate" href="/features/provider-fallback">
    Configure automatic failover between providers
  </Card>

  <Card title="Supported Models" icon="list" href="/reference/supported-models">
    Full model list by provider
  </Card>

  <Card title="Coder Mode" icon="code" href="/core-concepts/coder-mode">
    Use GitHub Models in engineering mode
  </Card>
</CardGroup>
