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.
| Field | Type | Description |
|---|---|---|
modelRequired | string | deepgram-voice-agent. |
deepgram-voice-agent
| Field | Type | Description |
|---|---|---|
promptDefault a short helpful-agent line | string | Who the agent is. Up to 25,000 characters on a managed LLM. |
greeting | string | The first line the agent speaks. Omit for none. |
listen_modelDefault nova-3 | string | nova-3, flux-general-en, or flux-general-multi. |
think_providerDefault open_ai | string | open_ai, anthropic, google, groq, or nvidia. |
think_modelDefault gpt-4o-mini | string | Managed 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_url | string | Your own LLM endpoint. Required for groq. Omit it and the managed model stays. |
think_endpoint_authorization | string | Authorization header for that endpoint. The save response hides it and returns think_endpoint_authorization_set. |
speak_providerDefault deepgram | string | deepgram, eleven_labs, cartesia, or open_ai. |
speak_modelDefault flux-kit-en | string | Deepgram voice, or the other provider’s voice id. |
speak_endpoint_url | string | Required when speak_provider is not deepgram. |
functionsDefault [] | array | Tools. Each item has name, description, and parameters. |
Save
POST /v1/agents/voice/profiles
| Field | Type | Description |
|---|---|---|
modelRequired | string | deepgram-voice-agent. |
name | string | The 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. |
fields | object | The 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.
| Field | Type | Description |
|---|---|---|
modelRequired | string | Query field. deepgram-voice-agent. |
api_key | string | API key, sent on the query string from a browser. |
session.profileRequired | string | Saved profile name for this model. |
session.sample_rateDefault 16000 | integer | Rate of the PCM bytes. 8000, 16000, 24000, 44100, or 48000. |
binary frame | bytes | Little-endian PCM16, mono, at session.sample_rate. |
session.close | object | Ends the call. |
Server events
| Field | Type | Description |
|---|---|---|
session.created | object | The 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 events | object | Deepgram events are forwarded as JSON. Deepgram audio is binary PCM16 at 24000 Hz. |
error | object | error.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