veevo.ai

Callbacks

Implement three POST endpoints to control your voice agent.

POST onCallStart

Called when a call comes in, before the conversation starts. Return the full call configuration.

Veevo sends

{
  "callSid": "CA...",
  "callerPhone": "+19805551234",
  "calledNumber": "+15551234567",
  "timestamp": "2026-04-03T..."
}

Your backend returns

{
  "twilioAccountSid": "AC...",
  "twilioAuthToken": "...",
  "openaiApiKey": "sk-...",
  "systemPrompt": "You are a helpful assistant for...",
  "voice": "marin",
  "model": "gpt-realtime-1.5",
  "onToolCallUrl": "https://your-backend.com/calls/tool",
  "tools": []
}
!
Timeout: 10 seconds. If your backend doesn't respond, the call is rejected.

Configuration Fields

FieldRequiredDefaultDescription
twilioAccountSidyesTwilio account SID
twilioAuthTokenyesTwilio auth token
openaiApiKeyyesOpenAI key with Realtime API access
systemPromptyesThe AI agent's instructions
voicenomarinalloy, ash, ballad, coral, echo, sage, shimmer, verse, marin, cedar
modelnogpt-realtime-1.5gpt-realtime-1.5 or gpt-realtime-mini
vadEagernessnohighlow, medium, high, auto
noiseReductionnonear_fieldnear_field or far_field
inactivityTimeoutMsno60000Auto-hangup after silence (ms)
greetingUrlnoMP3 URL played before AI connects
onToolCallUrlyesWhere tool calls are POSTed
toolsno[]OpenAI function definitions
metadatanoPassed through to onToolCall and onCallEnd

POST onToolCall

Called when the AI invokes a tool defined in the tools array.

Veevo sends

{
  "toolName": "check_availability",
  "arguments": { "date": "April 15, 2026" },
  "metadata": { "customerId": "cust_123" },
  "timestamp": "2026-04-03T..."
}

Your backend returns

{
  "result": "We have 3 standard units available for April 15."
}
i
Timeout: 30 seconds. The AI is blocked during this time — keep responses fast (<500ms) for natural conversation flow.

POST onCallEnd

Called after the call ends. Contains the full transcript and cost breakdown.

{
  "callSid": "CA...",
  "transcript": [
    { "role": "assistant", "content": "Hi, how can I help?", "timestamp": 1711900000 },
    { "role": "user", "content": "I need two units delivered Friday.", "timestamp": 1711900005 }
  ],
  "costBreakdown": {
    "inputTextTokens": 365,
    "inputAudioTokens": 90,
    "outputTextTokens": 45,
    "outputAudioTokens": 109,
    "costInputText": 0.00146,
    "costInputAudio": 0.00288,
    "costOutputText": 0.00072,
    "costOutputAudio": 0.006976,
    "costTwilio": 0.006647,
    "totalCost": 0.018483
  },
  "durationSeconds": 47,
  "metadata": { "customerId": "cust_123" },
  "timestamp": "2026-04-03T..."
}