wss://api.pascalai.co/v1/agents/voice

Voice agent

Save a Deepgram profile, then open one socket. A profile saved in the studio is the same record this API uses.

Send Authorization: Bearer. A browser sends the key as api_key on the query string.

Fields

GET /v1/agents/voice/fields?model=MODEL

The response lists that model’s fields, the default for each, and the allowed options. A field the model does not list is rejected when you save.

FieldTypeDescription
modelRequiredstringdeepgram-voice-agent.

deepgram-voice-agent

FieldTypeDescription
prompt
Default a short helpful-agent line
stringWho the agent is. Up to 25,000 characters on a managed LLM.
greetingstringThe first line the agent speaks. Omit for none.
listen_model
Default nova-3
stringnova-3, flux-general-en, or flux-general-multi.
think_provider
Default open_ai
stringopen_ai, anthropic, google, groq, or nvidia.
think_model
Default gpt-4o-mini
stringManaged model name. Small names such as gpt-4o-mini and claude-haiku-4-5 are $0.075. Larger names such as gpt-4o, gpt-5, and claude-sonnet-4-6 are $0.163. A name that is not on the small list uses $0.163. Omit the endpoint and Deepgram runs it.
think_endpoint_urlstringYour own LLM endpoint. Required for groq. Omit it and the managed model stays.
think_endpoint_authorizationstringAuthorization header for that endpoint. The save response hides it and returns think_endpoint_authorization_set.
speak_provider
Default deepgram
stringdeepgram, eleven_labs, cartesia, or open_ai.
speak_model
Default flux-kit-en
stringDeepgram voice, or the other provider’s voice id.
speak_endpoint_urlstringRequired when speak_provider is not deepgram.
functions
Default []
arrayTools. Each item has name, description, and parameters.

Save

POST /v1/agents/voice/profiles

FieldTypeDescription
modelRequiredstringdeepgram-voice-agent.
namestringThe id. Lowercased. Letters, numbers, and hyphens, up to 32 characters, starting with a letter. Leave it out and the next free deepgram1 is assigned. A name already on the account is rejected.
fieldsobjectThe fields for that model. Omit one and its default is stored.

The response is name, model, fields, and created_at. List with GET /v1/agents/voice/profiles. Edit with PATCH /v1/agents/voice/profiles/NAME. The edit body is fields. The name stays. On a Deepgram edit, omit think_endpoint_authorization to keep it. Send an empty string to clear it.

Call

wss://api.pascalai.co/v1/agents/voice?model=MODEL

Wait for session.created. Send one session.update before audio. session.profile is required. Audio sent before that update is rejected. session.update is rejected after audio starts.

FieldTypeDescription
modelRequiredstringQuery field. deepgram-voice-agent.
api_keystringAPI key, sent on the query string from a browser.
session.profileRequiredstringSaved profile name for this model.
session.sample_rate
Default 16000
integerRate of the PCM bytes. 8000, 16000, 24000, 44100, or 48000.
binary framebytesLittle-endian PCM16, mono, at session.sample_rate.
session.closeobjectEnds the call.

Server events

FieldTypeDescription
session.createdobjectThe socket is open. session.id, session.model, session.sample_rate, and session.prepaid_seconds. sample_rate is 16000 until session.update sets another rate.
vendor eventsobjectDeepgram events are forwarded as JSON. Deepgram audio is binary PCM16 at 24000 Hz.
errorobjecterror.type, error.code, error.message, and error.param. The socket then closes.

Price

$0.075 per connected minute on a small managed model. A larger managed model, such as Claude Sonnet or gpt-4o, is $0.163, or $0.122 with a voice that is not Deepgram. Bringing your own LLM is $0.065. Bringing your own LLM and voice is $0.050. Swapping only the voice is $0.065. On an API call the request fee is not charged. A studio call needs a Creator plan or an API balance.

Example

const socket = new WebSocket(
  'wss://api.pascalai.co/v1/agents/voice?model=deepgram-voice-agent&api_key=' + key
);
socket.binaryType = 'arraybuffer';
socket.onmessage = (event) => {
  if (typeof event.data !== 'string') return;
  const payload = JSON.parse(event.data);
  if (payload.type === 'session.created') {
    socket.send(JSON.stringify({
      type: 'session.update',
      session: { profile: 'support', sample_rate: 16000 },
    }));
  }
};
// then binary little-endian PCM16 mono