Skip to Content
Agent ServiceInterview

Interview

The interview module offers two modes: a turn-based REST flow (text), and a realtime WebSocket that proxies a voice model.

REST (turn-based)

Start a session, then exchange messages by session_id.

ActionMethod & path
StartPOST /api/interview/start
Send a messagePOST /api/interview/chat
End sessionDELETE /api/interview/session/:sessionId
// POST /api/interview/start { "resume_context": "Senior FE, 6y React, led design system…", "job_description": "We need a frontend lead…", "role": "frontend", "config": { "model": "gpt-4o-mini" } }

Returns a session (including the session_id) and the opening question.

Field (start)TypeRequired
resume_contextstring
job_descriptionstring
rolestring
configobject

Realtime (voice) WebSocket

For a live voice interview, connect to the realtime endpoint. It is not a Nest gateway — main.ts attaches it to the raw HTTP server, so it lives at:

ws://localhost:3112/api/interview/realtime/:sessionId

The service upgrades the connection and proxies upstream to an OpenAI-compatible realtime API, relaying audio/text both ways. Configure it via query params:

Query paramPurpose
api_keyUpstream API key (or sent as a bearer header)
modelRealtime model name
base_urlUpstream base URL (defaults to OpenAI realtime)
roleInterviewer persona / role (falls back to the session’s role)
const ws = new WebSocket( 'ws://localhost:3112/api/interview/realtime/sess_abc' + '?model=gpt-4o-realtime-preview&role=frontend&api_key=sk-...' ) ws.onmessage = (e) => handleRealtimeFrame(JSON.parse(e.data)) ws.onopen = () => ws.send(JSON.stringify({ type: 'response.create' }))

The realtime socket relays your api_key to the upstream provider. Terminate it behind your own gateway and inject the key server-side — never ship a real provider key to a browser client.

Start a REST session first to establish server-side interview state (resume context, role); the realtime socket can then reference the same sessionId.

Last updated on