> ## Documentation Index
> Fetch the complete documentation index at: https://codegeninc-codegen-bot-add-cli-model-options-1756938362.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Codegen CLI

export const CODEGEN_SDK_GITHUB_URL = "https://github.com/codegen-sh/codegen-sdk";

export const COMMUNITY_SLACK_URL = "https://community.codegen.com";

# Codegen CLI Manual

Welcome to the Codegen CLI documentation. This guide covers all available commands and their usage patterns.

## Installation

```bash
uv tool install codegen
```

## Initialization

```bash
codegen login
```

## CLI Reference

### `codegen` (root)

**Description:** Launches the interactive TUI if no subcommand is provided.

***

### `codegen agent`

**Description:** Create a new agent run with a prompt, fetch an existing agent run by ID, or pull PR branch.

**Usage Patterns:**

* **Create run:** `codegen agent --prompt "Your prompt"`
* **Get run JSON:** `codegen agent --id 123 --json`
* **Pull PR branch:** `codegen agent --id 123 pull`

**Options:**

* `--prompt, -p TEXT` The prompt to send to the agent (mutually exclusive with --id unless using create)
* `--id INT` Agent run ID to fetch or pull
* `--json` Output raw JSON response when fetching (flag)
* `--org-id INT` Organization ID (defaults to CODEGEN\_API\_TOKEN/REPOSITORY\_ORG\_ID or auto-detect)
* `--model TEXT` Model to use for this agent run (optional, see [Available Models](#available-models) below)
* `--repo-id INT` Repository ID to use for this agent run (optional)

**Positional Actions:**

* `pull` Pull the PR branch associated with an agent run (requires --id)

***

### `codegen agents`

**Description:** List and manage agent runs.

**Usage Patterns:**

* **List runs:** `codegen agents list`
* **Get run details:** `codegen agents get 123`

**Options:**

* `--org-id INT` Organization ID (defaults to CODEGEN\_ORG\_ID/REPOSITORY\_ORG\_ID or auto-detect)
* `--limit INT` Maximum number of runs to return (default: 10)
* `--json` Output raw JSON response (flag)

***

### `codegen login`

**Description:** Store authentication token.

**Usage Patterns:**

* **Interactive login:** `codegen login`
* **Token login:** `codegen login --token YOUR_API_TOKEN`

**Options:**

* `--token TEXT` API token to store
* `--no-verify` Skip token verification (flag)

***

### `codegen logout`

**Description:** Clear stored authentication token.

**Usage Pattern:**

* `codegen logout`

***

### `codegen org`

**Description:** Manage and switch between organizations.

**Usage Patterns:**

* **List organizations:** `codegen org list`
* **Switch organization:** `codegen org switch ORG_ID`
* **Get current organization:** `codegen org current`

**Options:**

* `--json` Output raw JSON response (flag)

***

### `codegen repo`

**Description:** Manage repository configuration and environment variables.

**Usage Patterns:**

* **List repositories:** `codegen repo list`
* **Configure repository:** `codegen repo config REPO_NAME`
* **Get repository details:** `codegen repo get REPO_ID`

**Options:**

* `--org-id INT` Organization ID (defaults to CODEGEN\_ORG\_ID or auto-detect)
* `--json` Output raw JSON response (flag)

***

## Available Models

The `--model` parameter accepts the following model identifiers:

### OpenAI Models

* `gpt-4o` - GPT-4 Omni model
* `gpt-4.1` - GPT-4.1 model
* `gpt-4.5` - GPT-4.5 model
* `gpt-5` - GPT-5 model with reasoning capabilities
* `o1` - OpenAI O1 reasoning model
* `o3` - OpenAI O3 reasoning model
* `o4` - OpenAI O4 reasoning model
* `deepseek-chat` - DeepSeek Chat model

### Anthropic Models

* `claude-3-7-sonnet` - Claude 3.7 Sonnet
* `claude-3-5-sonnet` - Claude 3.5 Sonnet

### xAI Models

* `grok-2` - Grok 2 model
* `grok-3` - Grok 3 model
* `grok-3-fast` - Grok 3 Fast variant
* `grok-3-mini` - Grok 3 Mini variant
* `grok-3-mini-fast` - Grok 3 Mini Fast variant
* `grok-4` - Grok 4 model
* `grok-code-fast` - Grok Code Fast model
* `grok-code-fast-1` - Grok Code Fast 1 model
* `grok-code-fast-1-0825` - Grok Code Fast 1 (August 25 version)

### Google Models

* `gemini-1.5-pro` - Gemini 1.5 Pro
* `gemini-2.5` - Gemini 2.5

**Example Usage:**

```bash
codegen agent --prompt "Fix the login bug" --model "claude-3-5-sonnet"
codegen agent --prompt "Refactor this code" --model "gpt-4o"
```

**Note:** If no model is specified, your organization's default model will be used.

***

## Get Started

<CardGroup cols={2}>
  <Card title="Create Account" icon="user-plus" href="https://codegen.sh/login">
    Sign up for a free account and get your API token.
  </Card>

  <Card title="Join our Slack" icon="slack" href={COMMUNITY_SLACK_URL}>
    Get help and connect with the Codegen community.
  </Card>

  <Card title="Tutorials" icon="diagram-project" href="/tutorials/at-a-glance">
    Learn how to use Codegen for common code transformation tasks.
  </Card>

  <Card title="View on GitHub" icon="github" href={CODEGEN_SDK_GITHUB_URL}>
    Star us on GitHub and contribute to the project.
  </Card>
</CardGroup>
