# Codex + your provider

Give a Codex launch setup its own model provider, or use a native profile you already have.

## Get the provider details

Install Codex and get your provider’s base URL, API key, and model ID. The endpoint must support the OpenAI Responses API; Chat Completions compatibility is not enough.

The example adds `Codex · work` without changing other Codex entries or editing Codex’s global configuration.

Already have a Codex profile? Skip to [Use an existing Codex profile](https://facadecode.com/docs/providers/codex/#profile).

## 1. Define the provider

Add this setup to facade.json (see [Agent settings](https://facadecode.com/docs/settings/)). Replace the example base URL, key, and model ID:

```json
{
  "clis": {
    "Codex · work": {
      "type": "codex",
      "model": "YOUR_MODEL_ID",
      "args": [
        "-c",
        "model_provider=work",
        "-c",
        "model_providers.work.name=Work",
        "-c",
        "model_providers.work.base_url=https://api.example.com/v1",
        "-c",
        "model_providers.work.wire_api=responses",
        "-c",
        "model_providers.work.env_key=WORK_API_KEY"
      ],
      "env": {
        "WORK_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

Use the same provider ID, `work`, in `model_provider=work` and every `model_providers.work.…` setting. The key’s variable name, `WORK_API_KEY`, must match `env_key`.

## 2. Check the provider settings

| Setting | What it does |
| --- | --- |
| `model_provider=work` | Selects the provider defined by the work settings. |
| `model_providers.work.name` | Gives that provider a display name. |
| `model_providers.work.base_url` | Sets the API base URL. |
| `model_providers.work.wire_api=responses` | Uses the Responses API format. |
| `model_providers.work.env_key=WORK_API_KEY` | Tells Codex which environment variable contains the key. |
| `env.WORK_API_KEY` | Supplies that key to the Codex process. |

Each `-c` sets one Codex option for agents started with this entry.

The example stores the key in facade.json. If the key already lives in an environment variable, set `env.WORK_API_KEY` to `${env:WORK_API_KEY}`. The editor must have that variable before the agent starts.

## 3. Start Codex with this setup

Save facade.json, choose **New Agent**, and select `Codex · work`. Use `/model` to check the selected model, then send a short task for your project.

If your provider reports usage, confirm that the request appears on the right account. To check the launch configuration, run **Show Agent Launch** and choose the working location. Find this entry in the report to see how the next agent would start with your current settings.

For request errors, see [Troubleshooting](https://facadecode.com/docs/troubleshooting/).

## Example: QwenCloud

For a QwenCloud Token Plan key, use `https://token-plan.maas.qwencloudapi.com/compatible-mode/v1` as the base URL and keep `wire_api=responses`. Use a model available on your plan. Pay-as-you-go keys use the endpoint for their region.

[QwenCloud’s current Codex settings ↗](https://docs.qwencloud.com/developer-guides/clients-and-developer-tools/codex)

## Use an existing Codex profile

If you already use a native Codex profile, select it through the entry’s arguments:

```json
{
  "clis": {
    "Codex · profile": {
      "type": "codex",
      "args": [
        "--profile",
        "work"
      ]
    }
  }
}
```

Replace `work` with the profile you use. Keep the provider configuration in that profile instead of repeating it in the Facade entry. Save, choose **New Agent**, and select `Codex · profile`. Send a short task and confirm the request in your provider’s usage records, where available.
