OpenAI Codex

Use v0 inside OpenAI Codex to run prompts from the terminal.

The Codex CLI lets you run prompts from the terminal using the v0-1.5-md model over the v0 API.

Prerequisites

  • You have Node.js installed.

Install Codex CLI

Install Codex globally:

npm install -g @openai/codex

Set your API key

Set your v0 API key as an environment variable:

export V0_API_KEY="your-api-key-here"

You can add this line to your shell profile (e.g. ~/.zshrc or ~/.bashrc) for persistence.

Configure Codex

Create a config file at ~/.codex/config.toml:

model_provider = "v0"
model = "v0-1.5-md"

[model_providers.v0]
name = "v0"
base_url = "https://api.v0.dev/v1"
wire_api = "chat"
env_key = "V0_API_KEY"

Make sure the env_key matches the V0_API_KEY environment variable.

Run Codex

You can now run Codex using the v0-1.5-md model:

codex

This will open a prompt in your terminal where you can interact with the model.

By using our API, you agree to our API Terms.