---
title: "Brain Llm"
method: POST
path: "/api/v1/voice/brain-llm/{interview_id}/chat/completions"
tags: ["voice", "voice"]
---

# Brain Llm

`POST /api/v1/voice/brain-llm/{interview_id}/chat/completions`

## Request

- Base URL: `https://api.thebetterhire.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.thebetterhire.ai/api/v1/voice/brain-llm/{interview_id}/chat/completions`
- Auth: none declared

Vapi-shaped chat-completions endpoint backed by the brain orchestrator.

Path note: Vapi's `custom-llm` provider treats the configured `model.url`
as a BASE URL and appends `/chat/completions` (OpenAI convention) when
POSTing turn payloads. So the URL we pass in assistant_config is
`https://.../api/v1/voice/brain-llm/{id}` and Vapi actually hits
`.../brain-llm/{id}/chat/completions`. This route's path matches that.

Streaming contract — the response starts BEFORE the brain turn finishes:
  delta(role=assistant) -> [keepalive chunks while the turn runs] ->
  delta(content=<next_question>) -> finish_reason=stop

v0.2.17 (Batch A / Stage 2 — A3): the close path (finished /
error / timeout) emits the same shape — delta(content) →
finish_reason=stop — instead of the previous tool_calls=[{name:
"endCall"}] tail that cut TTS mid-sentence. Vapi terminates the
call via `endCallPhrases` (configured in interview_join.py)
matched against the brain's natural close phrasing, waiting for
the matched-phrase TTS to finish playing before hanging up.

## Path parameters

- `interview_id` string, required

## Request body

- ChatCompletionsRequest
  - `model` string, nullable
  - `messages` ChatMessage[]
    - `role` string, required
    - `content` string, nullable
  - `stream` boolean

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/thebetterhire/apis/interanalysis-b2b-api.md) · [All operations](https://skmtc.dev/thebetterhire/apis/interanalysis-b2b-api/llms.txt) · [OpenAPI document](https://skmtc.dev/thebetterhire/apis/interanalysis-b2b-api/revisions/c8ad03e900ea?raw)
