---
metadata:
  - name: generator
    content: Diplodoc Platform v5.66.0
alternate:
  - https://sourcecraft.dev/portal/docs/en/cli-ref/src-codex.md
  - https://sourcecraft.dev/portal/docs/ru/cli-ref/src-codex.md
  - href: https://sourcecraft.dev/portal/docs/en/cli-ref/src-codex.md
    type: text/markdown
    title: Markdown version
  - href: https://sourcecraft.dev/portal/docs/en/llms.txt?revision=r21973087
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt?revision=r21973087

# src codex

Launch Codex with SourceCraft configuration.

This command starts Codex with the proper environment configured to use
SourceCraft as the AI provider. It handles:
* Ensuring the Codex binary is installed
* Copying default configuration if needed
* Setting up the LLM proxy for SourceCraft authentication

## Usage

`src codex [-- codex-args...] [flags]`

### Available commands

| Command | Description |
| --- | --- |
| [attach](src-codex-attach.md) | Attach a terminal to a running Codex app-server |
| [install](src-codex-install.md) | Install Codex if missing |
| [serve](src-codex-serve.md) | Start Codex app-server on a given port (used by IDE plugins) |

### Flags

| Flag | Description |
| --- | --- |
| `--autoinstall` | Auto-install Codex if not present |
| `--log-llm` | Log LLM requests to files (via local proxy) |
| `--model string` | Model to use (overrides config) |
| `--no-tools` | Do not load sourcecraft API tools, commands and modes |
| `--reset-config` | Reset bundled config files to defaults |

### Inherited flags

| Flag | Description |
| --- | --- |
| `--env string` | Override Sourcecraft environment (use 'src envs' to list available) |
| `--json string` | Output JSON, optionally filtered (--json or --json=field1,field2) |
| `--json-compact string` | Output compact JSON, optionally filtered |
| `-R, --repo string` | Select another repository using OWNER/REPO format |
| `-V, --verbose` | Enable debug logging output |

### Learn more

Use `src codex <subcommand> --help` for more information about a command.
