> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ccs.kaitran.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# iFlow Provider

> Access iFlow AI models via OAuth authentication

# iFlow Provider

Access iFlow AI models through Browser OAuth authentication. Seamless integration with Claude Code for instant model switching.

## Overview

The iFlow provider enables Claude Code to use iFlow's AI platform through Browser OAuth authentication with callback server on port 11451.

**Provider Identifier:** `iflow`

**Command:** `ccs iflow`

**Supported Models:**

* Various models available via iFlow platform
* Model selection configurable via CLIProxy settings

## Authentication

### First-Time Setup

```bash theme={null}
# Run iFlow for the first time
ccs iflow "review this code"

# Browser OAuth flow starts automatically
# → Browser opens for iFlow OAuth consent
# → Callback server spawns on port 11451
# → Token cached at ~/.ccs/cliproxy/auth/
# → Future runs require no re-auth
```

**Browser OAuth Flow:**

1. Authorization Code flow via browser callback
2. Callback server spawns on port 11451
3. Browser opens for iFlow OAuth consent
4. Token received via HTTP callback
5. Auto-refresh prevents mid-request failures

**Example Output:**

```
Authenticate with iFlow:
Opening browser for OAuth authentication...
Callback server listening on port 11451...

Browser opened for authentication.
```

### Manual Authentication

```bash theme={null}
# Authenticate without starting a session
ccs iflow --auth

# Headless mode (server/SSH environments)
ccs iflow --headless
# → Displays URL for manual browser authentication
# → Includes SSH tunnel instructions if needed
```

### Logout

```bash theme={null}
# Clear all iFlow tokens
ccs iflow --logout
```

## Multi-Account Support

Manage multiple iFlow accounts for different projects:

### Add Account

```bash theme={null}
# Add new account (preserves existing)
ccs iflow --auth --add
```

### List Accounts

```bash theme={null}
# Show all authenticated iFlow accounts
ccs iflow --accounts

# Output:
# Accounts for iflow:
#   [default] work (work@company.com)
#   personal (personal@example.com)
```

### Switch Account

```bash theme={null}
# Switch to specific account by nickname
ccs iflow --use personal

# Next command uses personal's account
ccs iflow "your prompt"
```

### Rename Account

```bash theme={null}
# Rename default account nickname
ccs iflow --nickname primary-account
```

**Account Registry:** `~/.ccs/cliproxy/accounts.json`

**Auto-Nicknames:** Generated from email prefix (e.g., `john@example.com` → `john`)

## Configuration Options

### Model Settings

iFlow provider settings stored in:

**Path:** `~/.ccs/iflow.settings.json`

**Configuration via Dashboard:**

```bash theme={null}
# Open web config interface
ccs config

# Navigate to CLIProxy → iFlow settings
```

**Manual Configuration:**

```json theme={null}
{
  "env": {
    "ANTHROPIC_MODEL": "iflow-model-name",
    "ANTHROPIC_MAX_TOKENS": "8192"
  }
}
```

### CLIProxy Integration

iFlow integrates with unified CLIProxy config:

**Path:** `~/.ccs/cliproxy/config.yaml`

**Provider Routing:** Requests routed to `/api/provider/iflow` endpoint

**Concurrent Usage:** Run iFlow + other providers simultaneously without conflicts

## Commands

### Basic Usage

```bash theme={null}
# Run with iFlow
ccs iflow "analyze this database schema"

# Interactive chat
ccs iflow
```

### Authentication Flags

| Flag           | Description                     |
| -------------- | ------------------------------- |
| `--auth`       | Trigger OAuth flow (no session) |
| `--logout`     | Clear all tokens                |
| `--auth --add` | Add new account (keep existing) |

### Account Management Flags

| Flag                | Description            |
| ------------------- | ---------------------- |
| `--accounts`        | List all accounts      |
| `--use <nickname>`  | Switch default account |
| `--nickname <name>` | Rename default account |

## Storage Locations

| Path                                | Purpose                         |
| ----------------------------------- | ------------------------------- |
| `~/.ccs/cliproxy/auth/iflow-*.json` | OAuth tokens (one per account)  |
| `~/.ccs/cliproxy/accounts.json`     | Account registry with nicknames |
| `~/.ccs/iflow.settings.json`        | Provider-specific settings      |
| `~/.ccs/cliproxy/config.yaml`       | CLIProxy unified config         |

## Token Management

**Storage Format:**

```json theme={null}
{
  "type": "iflow",
  "access_token": "...",
  "refresh_token": "...",
  "email": "user@example.com",
  "expired": "2024-12-31T23:59:59Z"
}
```

**Auto-Refresh:** Tokens managed by CLIProxyAPI

**Security:** Device Code flow prevents token interception (no callback server)

## Device Code Flow Details

**Why Device Code?**

* More secure (no callback server listening on local port)
* Works seamlessly in headless environments
* No port conflicts or firewall issues
* User completes auth on trusted device

**Flow Timeline:**

1. CCS requests device code from iFlow API
2. Displays code + URL to user
3. User authorizes in browser (any device)
4. CCS polls iFlow API for token availability
5. Token saved when authorization complete

**Callback Port:** `null` (no server required)

## Requirements

* iFlow subscription/account
* Browser for OAuth (on any device - not necessarily same machine)
* Network access to iFlow authentication servers

## Troubleshooting

### Device Code Expired

**Error:** "Device code expired before authorization"

**Solution:** Device codes expire after 10-15 minutes. Re-run `ccs iflow --auth` to get new code.

### Authorization Not Detected

```bash theme={null}
# Verify token file exists
ls ~/.ccs/cliproxy/auth/iflow-*.json

# Re-authenticate if missing
ccs iflow --logout
ccs iflow --auth
```

### Multi-Account Issues

```bash theme={null}
# List all accounts to verify state
ccs iflow --accounts

# Switch to specific account
ccs iflow --use <nickname>
```

### Token Expiry

Tokens refresh automatically via CLIProxyAPI. If refresh fails:

```bash theme={null}
# Re-authenticate
ccs iflow --auth
```

## Model Alias Normalization

<Note>Available since v7.51.0</Note>

CCS automatically normalizes legacy iFlow model IDs to their canonical equivalents. This prevents 406/404 errors when iFlow's API updates model naming.

**Known mappings:**

| Legacy Model ID      | Canonical Model ID |
| -------------------- | ------------------ |
| `kimi-k2.5`          | `kimi-k2`          |
| `deepseek-v3.2-chat` | `deepseek-v3.2`    |
| `glm-4.7`            | `glm-4.6`          |
| `minimax-m2.5`       | `qwen3-coder-plus` |

These mappings are applied automatically — no config change required. If you have `ANTHROPIC_MODEL` set to a legacy alias in your iFlow settings, it will continue to work.

## Cost Information

**iFlow Subscription/Account Required:** Check iflow\.ai for current pricing and subscription options

**Usage Limits:** Subject to iFlow's rate limits and subscription tier

## Next Steps

<CardGroup cols={2}>
  <Card title="Multi-Account Setup" icon="users" href="/tutorials/multi-account-setup">
    Manage multiple iFlow accounts
  </Card>

  <Card title="Dashboard Config" icon="gauge" href="/getting-started/configuration">
    Configure via web interface
  </Card>
</CardGroup>
