YMYour Model
Integrations

Use OpenAI Codex CLI with Your Model

Configure Codex CLI as a custom API provider.

Codex CLI compatibility varies by model and provider route.

Use the current official OpenAI Codex documentation for installation. This page focuses on Your Model provider configuration and does not duplicate installer commands that may change over time.

Store your key in an environment variable:

export YOURMODEL_API_KEY="YOUR_MODEL_API_KEY"

Configure a separate provider in ~/.codex/config.toml:

model = "YOUR_MODEL_ID"
model_provider = "yourmodel"

[model_providers.yourmodel]
name = "Your Model"
base_url = "https://y-models.com/v1"
env_key = "YOURMODEL_API_KEY"
wire_api = "responses"

Notes:

  • Get model IDs from /v1/models or the pricing page.
  • wire_api = "responses" only fits models and routes that truly support Responses API.
  • Codex has stricter compatibility needs than a basic Chat Completions request.
  • Prefer user-level ~/.codex/config.toml.
  • Never commit a real API key to a project repository.