Files
knowledge-base/docs/misc/cli-proxy-api.md
Arity-T a22368d2b3
All checks were successful
Build MkDocs / build-and-deploy (push) Successful in 30s
CLI proxy
2026-06-01 21:38:48 +03:00

74 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CLI Proxy API
[CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) - прокси для доступа к Codex и другим CLI-моделям через OpenAI-совместимый API. Можно подключать к Cursor и другим клиентам.
## Установка
На сервере должны быть установлены Docker и Docker Compose plugin. Порт `8317/tcp` должен быть открыт.
```sh
git clone https://github.com/router-for-me/CLIProxyAPI.git
cd CLIProxyAPI
cp config.example.yaml config.yaml
```
Для удалённого доступа к Web UI и статистики использования добавляем в `config.yaml`:
=== "Терминал"
```sh
nano config.yaml
```
=== "config.yaml"
```yaml
remote-management:
allow-remote: true
secret-key: "your-very-long-secret"
disable-control-panel: false
usage-statistics-enabled: true
```
Запускаем контейнер.
```sh
docker compose up -d
docker compose logs -f
```
## OAuth-логин Codex
Логин выполняется на удалённом сервере, но браузер открывается локально - для этого пробрасываем порт через SSH.
```sh
ssh -L 1455:localhost:1455 <user>@<server>
cd ~/CLIProxyAPI
docker compose exec cli-proxy-api /CLIProxyAPI/CLIProxyAPI -no-browser --codex-login
```
## Проверка
Список доступных моделей:
```sh
curl http://<IP>:8317/v1/models \
-H "Authorization: Bearer your-api-key-1"
```
Web UI управления: `http://<IP>:8317/management.html`
## Подключение Cursor
В настройках Cursor (`ctrl + shift + j`) → **Models** → **API Keys** → **OpenAPI** указываем:
- **API Key** - ключ из конфига
- **Base URL** - `http://<IP>:8317/v1`
## Полезные ссылки
- [Codex usage и лимиты](https://chatgpt.com/codex/settings/usage) - встроенная статистика использования