OpenAI-совместимый HTTP API для чата и completion. Веб-интерфейс: ghostgpt.io
OpenAI-compatible HTTP API for chat and completions. Web UI: ghostgpt.io
Главная ссылка для интеграции (Base URL): Main integration link (Base URL): https://api.ghostgpt.io/v1Дайте пользователям одну ссылку — эту страницу:
Share one link with your users — this page:
https://api.ghostgpt.io/
В настройках клиента укажите:
In your client settings use:
| Поле | Значение |
|---|---|
| Base URL / API URL | https://api.ghostgpt.io/v1 |
| Model | ghostgpt |
| API Key | Authorization: Bearer YOUR_KEY |
| Field | Value |
|---|---|
| Base URL / API URL | https://api.ghostgpt.io/v1 |
| Model | ghostgpt |
| API Key | Authorization: Bearer YOUR_KEY |
JSON-манифест: /api.json
Machine-readable manifest: /api.json
Важно: https://api.ghostgpt.io/v1 — это Base URL для клиентов, не страница в браузере. Откройте / (документация) или проверьте API: /v1/models.
Note: https://api.ghostgpt.io/v1 is the client Base URL, not a browsable page. Use / for docs or try /v1/models.
api.ghostgpt.io — обязателен заголовок Authorization: Bearer <api_key>.
api.ghostgpt.io requires Authorization: Bearer <api_key>.
Веб-чат на ghostgpt.io: cookie gg_sess после POST /api/session/bootstrap (или тот же Bearer).
Web chat on ghostgpt.io: gg_sess cookie after POST /api/session/bootstrap, or Bearer key.
curl https://api.ghostgpt.io/v1/models \ -H "Authorization: Bearer YOUR_KEY"
messages игнорируется — сервер подставляет свой промпт GhostGPT.grammar, json_schema, logit_bias (DoS-защита).max_tokens: 32–4096; меньше 32 → 4096.POST /api/web-research на ghostgpt.io и добавляйте текст в user-сообщение.grammar, json_schema, logit_bias (anti-DoS).max_tokens: 32–4096; below 32 clamped to 4096.POST /api/web-research on ghostgpt.io for API workflows.Список моделей:
List models:
GET https://api.ghostgpt.io/v1/models
Основная модель:
Default model:
ghostgpt
Мультимодальность — текст и изображения в messages.
Multimodal — text and images in messages are supported.
| Метод | Путь | Назначение |
|---|---|---|
| GET | /v1/models | Список моделей |
| POST | /v1/chat/completions | Чат (рекомендуется) |
| POST | /v1/completions | Legacy completion |
| GET | /health | Проверка сервера |
| Method | Path | Description |
|---|---|---|
| GET | /v1/models | List models |
| POST | /v1/chat/completions | Chat (recommended) |
| POST | /v1/completions | Legacy completion |
| GET | /health | Health check |
Основной способ — OpenAI Chat API.
Main method — same as OpenAI Chat API.
curl https://api.ghostgpt.io/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ghostgpt",
"messages": [
{"role": "user", "content": "Hello! What is GhostGPT API?"}
]
}'
pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://api.ghostgpt.io/v1",
api_key="YOUR_KEY",
)
resp = client.chat.completions.create(
model="ghostgpt",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
const r = await fetch("https://api.ghostgpt.io/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "ghostgpt",
messages: [{ role: "user", content: "Hello" }],
}),
});
const data = await r.json();
console.log(data.choices[0].message.content);
Добавьте "stream": true — ответ чанками (SSE), как в OpenAI.
Set "stream": true for chunked SSE responses, OpenAI-style.
curl https://api.ghostgpt.io/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "ghostgpt",
"stream": true,
"messages": [{"role": "user", "content": "Write a short poem"}]
}'
Картинка в messages в формате OpenAI (base64 или URL):
Pass an image in messages using OpenAI format (base64 or URL):
{
"model": "ghostgpt",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}}
]
}]
}
Эти ручки обслуживает сервис ghostgpt-tools на основном домене. Они не входят в /v1 OpenAI API.
These routes are served by ghostgpt-tools on the main site. They are not part of the OpenAI /v1 API.
Базовый URL: https://ghostgpt.io · Просмотр диалога: https://ghostgpt.io/share/{id}
Base URL: https://ghostgpt.io · View shared chat: https://ghostgpt.io/share/{id}
| Метод | Путь | Назначение |
|---|---|---|
| POST | /api/share | Создать публичную ссылку на диалог |
| GET | /api/share/{id} | JSON снимок диалога |
| POST | /api/fetch-url | Скачать и извлечь текст страницы |
| POST | /api/web-research | Подбор источников по запросу (курсы, погода) |
| POST | /api/session/bootstrap | Cookie gg_sess для веб-чата |
| POST | /api/pdf/extract | Текст из PDF (multipart, rate limit) |
| POST | /api/transcribe | Распознавание аудио (multipart) |
| Method | Path | Description |
|---|---|---|
| POST | /api/share | Create a public share link |
| GET | /api/share/{id} | JSON snapshot of shared chat |
| POST | /api/fetch-url | Fetch URL and extract text |
| POST | /api/web-research | Pick sources for a query (FX, weather) |
| POST | /api/session/bootstrap | gg_sess cookie for web chat |
| POST | /api/pdf/extract | Extract text from PDF (multipart, rate limited) |
| POST | /api/transcribe | Transcribe audio (multipart) |
Тело — массив блоков диалога (как в UI). Максимум ~2 MB.
Body — array of conversation blocks (same shape as the UI). Max ~2 MB.
curl -X POST https://ghostgpt.io/api/share \
-H "Content-Type: application/json" \
-d '[{
"conv": {"id": "example", "name": "My chat"},
"messages": [
{"role": "user", "content": "Hello", "timestamp": 1},
{"role": "assistant", "content": "Hi!", "timestamp": 2}
]
}]'
Ответ: {"id":"…","url":"https://ghostgpt.io/share/…"}
Response: {"id":"…","url":"https://ghostgpt.io/share/…"}
curl -X POST https://ghostgpt.io/api/fetch-url \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
Для пар с рублем — ЦБ РФ и Банки.ру; для USD/TRY и др. — Frankfurter; погода — Яндекс.
RUB pairs use CBR + banki.ru; international FX uses Frankfurter; weather uses Yandex.
curl -X POST https://ghostgpt.io/api/web-research \
-H "Content-Type: application/json" \
-d '{"query": "курс доллара к рублю"}'
api.ghostgpt.io/v1.api.ghostgpt.io/v1.Клик по вложению в чате открывает предпросмотр в браузере:
Click a chat attachment to preview in the browser:
POST /api/pdf/extractPOST /api/pdf/extractСтатика: /gg-doc-viewer.js, /vendor/*.js
Assets: /gg-doc-viewer.js, /vendor/*.js
Любой клиент с Custom OpenAI Base URL:
Any client with Custom OpenAI Base URL support:
openai (Python / Node) — Base URL https://api.ghostgpt.io/v1openai SDK (Python / Node) — Base URL https://api.ghostgpt.io/v1Веб-чат: ghostgpt.io
Web chat: ghostgpt.io
| Код | Значение |
|---|---|
| 401 | Нет API key / сессии |
| 400 | Неверный JSON или параметры |
| 404 | Неверный путь (нужен /v1/...) |
| 429 | Rate limit (nginx) |
| 502/503 | Сервер перегружен или модель грузится |
| 504 | Таймаут — уменьшите контекст |
| Code | Meaning |
|---|---|
| 401 | Missing API key / session |
| 400 | Invalid JSON or parameters |
| 404 | Wrong path (use /v1/...) |
| 429 | Rate limit (nginx) |
| 502/503 | Server busy or model loading |
| 504 | Timeout — reduce context size |