Files
autoreg-skills-max/skills/th-autoreg/references/gateway-endpoints.md

81 lines
3.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.

# VPS Gateway Endpoints (th-gateway v2.2)
Базовый URL: `https://[REDACTED-NAME].loc.cc/th/`
Gateway key: `thgw_YOUR_GATEWAY_KEY`
VPS: [REDACTED-IP], root, пароль: `dYqjygDyTtZ68Y59`
Код: `/opt/th_gateway/th_gateway.py`, стейт: `/opt/th_gateway/th_gateway_state.json`
Сервис: `systemctl restart th-gateway`
## Все эндпоинты (v2.2)
| Метод | Путь | Описание |
|-------|------|----------|
| GET | `/` | Список всех эндпоинтов |
| GET | `/status` | Статус регистрации + провайдеры |
| GET | `/providers` | Список провайдеров |
| GET | `/keys` | Все ключи (auth required) |
| GET | `/key?provider=X` | Случайный рабочий ключ (ротация, auth) |
| GET | `/models?provider=X` | Список моделей провайдера (auth) |
| POST | `/register?count=N` | Запуск регистрации (не работает на VPS — нет CDP) |
| POST | `/chat?provider=X` | Прокси chat completion (streaming) |
| POST | `/embeddings?provider=X` | Прокси embeddings |
| POST | `/images/generations?provider=X` | Прокси image generation |
| POST | `/provider/add?provider=X` | Добавить ключ (auth): `{"key":"thk_..."}` |
| POST | `/provider/remove?provider=X` | Удалить ключ (auth): `{"key":"thk_..."}` |
Auth: `Authorization: Bearer [REDACTED-KEY]`
## Провайдеры в state.json
**Важно:** ключи хранятся как **строки** (не dict'ы!):
```json
{
"providers": {
"shoot": {
"base_url": "https://sh00t.host/v1",
"keys": ["sk_p7VBxBRbetN5jFkDtlR5BGe7pTdcuj6NYhsxztJa4JO1vlty"],
"models": ["gpt-5.6-sol", "gpt-5.6-luna", ...]
},
"tokenharbor": {
"base_url": "https://tokenharbor.ai/v1",
"keys": ["thk_live_xxx", "thk_live_yyy"],
"models": 21
}
}
}
```
При патче `/provider/add` проверять на дубликат: `if api_key in keys`.
## Добавление ключа
```bash
curl -X POST "https://[REDACTED-NAME].loc.cc/th/provider/add?provider=tokenharbor" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [REDACTED-KEY]" \
-d '{"key":"thk_live_..."}'
```
## Удаление ключа
```bash
curl -X POST "https://[REDACTED-NAME].loc.cc/th/provider/remove?provider=tokenharbor" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [REDACTED-KEY]" \
-d '{"key":"thk_live_..."}'
```
## Проверка баланса ключа TokenHarbor
```bash
curl -s https://tokenharbor.ai/v1/models \
-H "Authorization: Bearer thk_live_..."
# 200 = жив, 401 = invalid, 402 = no balance
```
## Sh00t
Ключ: `sk_p7VBxBRbetN5jFkDtlR5BGe7pTdcuj6NYhsxztJa4JO1vlty`
Endpoint: `https://sh00t.host/v1`
13 моделей: gpt-5.6-sol, gpt-5.6-luna, gpt-5.6-terra, gpt-5.6, claude-opus-4-8, claude-sonnet-5, claude-opus-5, claude-fable-5, kimi-k3, glm-5.2, gemini-3-pro-image, gemini-3.1-flash-image, gemini-3.1-flash-lite-image.
Без префикса `cx/`.