# GPT-6 Astra — /chat/completions

OpenAI-compatible chat completions backed by GPT-6 Astra, the next-generation OpenAI flagship: a 1,050,000-token context, up to 128,000 output tokens, reasoning_effort up to xhigh, image input, tool calling and prompt caching. Set model to gpt-6-astra; the same model is also served on /v1/responses. Cached input settles at one tenth of the input rate. This model also returns a reasoning summary: choices[].message.reasoning_content when non-streaming, choices[].delta.reasoning_content when streaming. The answer itself stays in content and is never mixed with the reasoning, so clients that only read content need no changes. When reasoning_effort is omitted the gateway requests the medium tier (the model's own default) and the summary comes back all the same. Billing: thinking tokens are charged at the output rate and are included in usage.completion_tokens; usage.completion_tokens_details.reasoning_tokens breaks out how many were reasoning -- those tokens are billed whether or not you read the field. Note that OpenAI exposes only a summary of the reasoning, never the raw chain of thought, so this field is usually short. Note: this model is served over a ChatGPT-subscription upstream that does not accept temperature / top_p / max_tokens / max_completion_tokens / frequency_penalty / presence_penalty -- sending them is silently ignored (no error). Use reasoning_effort for thinking depth and prompt wording for length. For image input use a base64 data: URI; a public image URL may time out upstream.

**Эндпоинт:** `POST https://nezhagate.com/v1/chat/completions`

## Аутентификация
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## Тело запроса
| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `model` | string | Да | Model ID, here gpt-6-astra. |
| `messages` | array | Да | Массив сообщений; у каждого есть role (system/user/assistant) и content. content может быть строкой или массивом частей {type:text} и {type:image_url} для распознавания изображений (мультимодальность/зрение). |
| `stream` | boolean | Нет | Возвращать ответ потоково через SSE. По умолчанию false. |
| `web_search` | boolean | Нет | Установите true, чтобы включить веб-поиск: шлюз дополняет промпт актуальными результатами (со ссылками на источники) перед тем, как модель формирует ответ. Также можно включить через элемент tools вида {"type":"web_search"}. |
| `reasoning_effort` | string | Нет | Уровень рассуждения: low / medium / high / xhigh / max (у GPT-6 Astra нет уровня none; значения none и minimal обрабатываются как low). Если параметр не указан, шлюз запрашивает medium (значение по умолчанию у самой модели) и возвращает краткое изложение рассуждений в message.reasoning_content. |
| `tools` | array | Нет | Вызов функций. Передайте стандартный массив tools, как в OpenAI; когда модель решает вызвать функцию, она возвращает finish_reason=tool_calls вместе с tool_calls. Используйте вместе с tool_choice, чтобы принудительно указать конкретный инструмент. |
| `response_format` | object | Нет | Структурированный вывод. Передайте {"type":"json_object"}, чтобы модель возвращала только корректный JSON. |

## Пример запроса
```bash
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "gpt-6-astra", "messages": [{"role": "user", "content": "Hello"}], "stream": false}'
```

## Ответ
```json
{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "model": "gpt-6-astra",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "reasoning_content": "**Weighing the options** ... (a summary of how the model reasoned)",
        "content": "Hello!"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 11,
    "completion_tokens": 105,
    "total_tokens": 116,
    "completion_tokens_details": {"reasoning_tokens": 43}
  }
}
```

## Ввод изображений (Vision)
Поместите изображение в массив content сообщения, и модель проанализирует его (визуальные вопрос-ответ, распознавание текста / OCR, …). Поле image_url принимает публичную ссылку на изображение или встроенный base64 data URL (data:image/png;base64,...). Доступно для мультимодальных моделей (gpt-5.5, серия gemini, …).

```bash
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "gpt-6-astra", "messages": [{"role": "user", "content": [{"type": "text", "text": "What is in this image?"}, {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}]}]}'
```