# Codex Login

- **Method:** `POST`
- **Path:** `/api/v1/providers/codex/login`
- **Operation ID:** `codex_login`
- **Tags:** providers

Start connecting your ChatGPT subscription, so your runs' models can bill it: open `verification_url`,
type `user_code`, then poll `GET /api/v1/providers/codex` until `state` is `connected`.

A login serves only the caller that made it, and only runs that caller starts. A 409 is a login already
in flight; a 403 is a deployment that does not offer ChatGPT logins to this caller.

## Effective servers

- `https://api.saram.sh`

  Saram

## Authentication

- **HTTPBearer**: HTTP bearer

  a Saram API key (`sk_saram_<env>_...`) or a person's AuthKit access token, as `Authorization: Bearer <credential>`. Both are told apart by shape and produce the same principal.

## Responses

### 202 Successful Response

**Content type:** `application/json`

schema: `CodexLoginStarted`, no additional properties

`POST /api/v1/providers/codex/login`: open `verification_url`, type `user_code`, then poll `status_url`.

- **`caller` (required)**: `string`
- **`expires_in` (required)**: `integer`
- **`status_url` (required)**: `string`
- **`user_code` (required)**: `string`
- **`verification_url` (required)**: `string`

**Example:**

```json
{
  "caller": "",
  "user_code": "",
  "verification_url": "",
  "expires_in": 1,
  "status_url": ""
}
```

### 403 the API key lacks the required scope

## Schemas

- `CodexLoginStarted` — shown above.
