# CLIProxy API Reference

## Endpoint

```
POST http://127.0.0.1:8317/v1/chat/completions
```

## Headers

```http
Content-Type: application/json
Authorization: Bearer ccs-internal-managed
```

> **Note**: For standalone CLIProxy (no CCS), omit Authorization if OAuth session exists.

## Request Payload

```json
{
  "model": "gemini-3-pro-image-preview",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "text", "text": "Generate an image of..."},
      {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}}
    ]
  }],
  "max_tokens": 4096
}
```

## Response - Image Extraction

```
choices[0].message.images[0].image_url.url
```

Format: `data:image/jpeg;base64,<base64_data>`

## Health Check

```
GET http://127.0.0.1:8317/v1/models
```

Returns list of available models.

## Supported Models

| Model | Capability |
|:---|:---|
| `gemini-3-pro-image-preview` | ✅ Image generation |
| `gpt-5.x`, `codex` | ❌ Text-only |
| `dall-e-3` | ❌ Not available in CLIProxy |

## Troubleshooting

| Error | Solution |
|:---|:---|
| Connection refused | Start CLIProxy: `ccs config` |
| No models returned | Login: `ccs agy --login` |
| Model not found | Check available models via `/v1/models` |
