Chat

Создать chat completion

OpenAI-совместимый chat completions endpoint.

При stream: true возвращает Server-Sent Events стрим из chunk-ов в формате chat.completion.chunk. Подробности SSE-формата — на странице Streaming.

Hubris автоматически добавляет stream_options: { include_usage: true } ко всем stream-запросам, поэтому usage приходит в последнем chunk-е перед [DONE].

post/v1/chat/completions

Request

  • Base URL: https://api.hubris.pw
  • URL: https://api.hubris.pw/v1/chat/completions
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://api.hubris.pw/oauth/authorize, token URL https://api.hubris.pw/oauth/token, scopes: chat:write)

Request body

modelstring required
modelsstring[]

Список fallback-моделей. Если основная (model) недоступна — попробует следующие по порядку. Биллинг по фактически использованной (см. model в ответе).

parallel_tool_callsboolean
temperaturenumber
top_pnumber
ninteger
max_tokensinteger
max_completion_tokensinteger
frequency_penaltynumber
presence_penaltynumber
logit_biasobject
seedinteger
logprobsboolean
top_logprobsinteger
modalitiesstring[]

Какие модальности должна вернуть модель. По умолчанию ["text"]. Для генерации изображений: ["image","text"] (модели типа gemini-flash-image) либо ["image"] (модели типа flux/sdxl). Для голосового ответа: ["text","audio"] вместе с полем audio и обязательным stream: true. Поддерживается только моделями, у которых соответствующая модальность есть в output_modalities.

image_configobject

Параметры image-gen моделей: aspect_ratio (1:1, 16:9, 9:16 и т.д.), image_size (0.5K, 1K, 2K, 4K), а также model-specific поля. Конкретный набор зависит от модели — см. карточку модели в каталоге.

streamboolean
userstring
reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'

Example request

{
  "model": "anthropic/claude-haiku-4.5",
  "models": [
    "anthropic/claude-sonnet-4.6",
    "openai/gpt-4o-mini"
  ],
  "messages": [
    {
      "content": [
        {
          "input_audio": {
            "format": "wav"
          }
        }
      ]
    }
  ],
  "modalities": [
    "image",
    "text"
  ],
  "audio": {
    "voice": "alloy",
    "format": "wav"
  },
  "image_config": {
    "aspect_ratio": "16:9",
    "image_size": "2K"
  }
}

Response

Успешный ответ. При stream: false — chat.completion. При stream: true — text/event-stream с chunk-ами chat.completion.chunk.

idstring required
object'chat.completion' required
createdinteger required

Unix-timestamp в секундах.

modelstring required
system_fingerprintstring

Example response

{
  "id": "chatcmpl-abc123",
  "choices": [
    {
      "message": {
        "images": [
          {
            "image_url": {
              "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
            }
          }
        ]
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.