Skip to content

Set up a Gapi voice agent for a business ​

This page is for an AI coding assistant (Claude Code, Cursor, Codex and the like) that a Gapi customer has asked to set up, or to calibrate, a voice agent for their business. If you are that assistant: the customer has given you this page, the API's address and a project token, and expects a working agent that fits their business and their code. Getting an agent right is hard for a person in a form, which is why it is handed to you. How you get there is yours to work out: this page tells you what the platform can do, what a good result is, and what you must not do.

A Gapi voice agent answers phone calls and places them. It hears the caller (Uzbek, with Russian words mixed in), thinks with a language model and speaks Uzbek. You shape it through an API: what it knows and how it behaves (the instruction), the names it must hear right (the vocabulary), its habits in a conversation (the settings), what differs from call to call (variables), what it can do in the customer's own systems while it talks (functions), and when the customer's code has it call someone (calls).

What a good result is ​

  • The agent says only true things about the business, reaches the goal of the call in a few turns, and handles the awkward moments (too expensive, call me later, who are you, a service the business does not have).
  • It hears the business's own names: the company, its products, its people, its streets.
  • It is wired into the customer's code where that helps: their system starts calls with the right variables, and the agent's functions read and write real data through endpoints you built and tested.
  • The customer has heard it on a test call and agreed to what it says.
  • After the first five to ten real calls it has been calibrated once (the last section but two).
  • Nothing secret is left in the repository, and the customer knows what you created and how to change it.

Ground rules ​

  • The token. GAPI_TOKEN (gapi_..._...) is usually in the task the customer pasted; otherwise in the environment, or they copy the task again from the cabinet. Keep it in a shell variable for your requests. Never write it into a file of the repository, a commit, a log or your replies. If the customer's code needs it at run time (to start calls), it goes where their other secrets go.
  • Ask before anything that reaches a real person or costs money. A phone call is real and is paid for at the customer's telephony provider. Place one only when the customer asks, to a number they give.
  • Show before you create. The customer reads the instruction, and the list of what the agent may do, before the agent exists and before every change of substance.
  • Do not invent facts. A missing price or rule is a question to the customer, or a line telling the agent to say it will find out.
  • The phone number is the customer's part. It is connected in the cabinet with the SIP login their provider gave them. Do not ask for that password and do not send it anywhere.

What the platform gives you ​

Every request carries Authorization: Bearer $GAPI_TOKEN. Errors are JSON, {"error": "<code>", "hint": "<what to fix>"}; read the hint. 403 voice_not_available: the account is not in the voice canary yet; tell the customer to write to Gapi support and give them the instruction as text meanwhile.

The agent ​

GET $GAPI_URL/v1/voice/options answers what is on offer now: voices, models and limits. POST /v1/voice/agents creates an agent, GET /v1/voice/agents lists them, PUT /v1/voice/agents/{id} replaces one whole (send every field again), DELETE removes it.

FieldMeaningIf left out
namehow the agent is listed in the cabinetrequired
promptthe instruction, up to 8,000 charactersrequired
voicecharos (female) or sarvar (male); both speak as an operator in a neutral manner, so mood is carried by the wordsthe first
modela model's id from the optionsthe first
first_speakeragent greets first, caller waits for the other sideagent
speechconversational (everyday Tashkent pronunciation) or literaryconversational
interruptionswhether the caller may cut into the agent's speechtrue
patiencehow long the agent waits to be sure the caller has finished: 0.5 to 2, lower answers sooner1
silence_secondsafter this much silence the agent speaks again; 0 never8
vocabularythe names the recogniser must hear right (below)none
max_duration_secondsa call is ended after this longthe platform's limit
transfer{"to": "<phone number>", "when": "<when to hand the caller over>"}: a person's phone the agent may hand a phone caller over to (below)none
variablesthe places of the prompt and their defaults (below)none
toolsthe agent's functions (below)none

The cabinet edits the simple fields (name, instruction, voice, the habits) and shows variables and functions read-only; a save in the cabinet keeps them. Variables and functions are set through this API only.

Vocabulary ​

The recogniser writes ordinary Uzbek and Russian speech well and trips on names it has never seen: the company, brands and products, people, districts and streets, the business's own terms. Tell it what to expect. An agent's vocabulary is a list of such terms; the project has a list of its own as well (GET / PUT /v1/vocabulary{"terms": [...]}), the one its call recordings are transcribed with, and every agent of the project hears both: the agent's terms first, then the project's, twenty in all.

Choose them from the business, not from a dictionary: what a caller will say that is not a common word. Write each as it should appear in text (Latin letters for Uzbek: Namuna, Bunyodkor, amoCRM), at most four words and 80 characters a term. A name every agent of the business needs goes into the project's vocabulary; one that only this agent needs (the offer of this campaign, this branch's manager) goes into the agent's. Common words do not belong there: they push real names out of the twenty places and gain nothing.

Variables ​

A prompt may hold places for what differs from call to call: , . Declare each in variables with a default (a string; "" is allowed):

json
"prompt": "... Mijozning ismi: {{client_name}}. Buyurtma: {{order_summary}}. ...",
"variables": {"client_name": "", "order_summary": "ma’lumot yo‘q"}

A call your code starts gives the values it knows ("variables" in POST /v1/voice/calls); the rest take their defaults. A call that comes in on a phone number gets only the defaults, so write the instruction to read well with them (an empty name must not leave "Hurmatli ," in the greeting). Names are lower-case Latin letters, digits and _; up to 20; a value up to 2,000 characters. A place that is not declared is refused when the agent is saved.

Three places are the platform's own and need no declaring: (2026-11-12), (chorshanba) and (15:04), the moment the call starts in Tashkent. An agent that books "tomorrow" has to be told what today is: put them in the instruction ("Bugun , .").

POST /v1/voice/agents/{id}/prompt {"variables": {...}} answers the prompt exactly as a call with those values would hand it to the model. Use it to check your variables without placing a call.

Functions ​

A function is something the agent may do in the customer's systems while it talks: find a free hour, book a visit, look up an order, record a complaint. You describe it; the model decides when to call it.

json
"tools": [{
  "name": "book_visit",
  "description": "Books a visit. Call it once the caller has agreed to a day and an hour and given their name.",
  "parameters": {"type": "object", "properties": {
      "day": {"type": "string", "description": "YYYY-MM-DD"},
      "time": {"type": "string", "description": "HH:MM, 24-hour"},
      "name": {"type": "string"}},
    "required": ["day", "time", "name"]},
  "url": "https://crm.example.uz/gapi/functions",
  "headers": {"Authorization": "Bearer <a secret of the customer's own for this endpoint>"},
  "timeout_ms": 8000
}]

When the model calls it, the platform sends, from its own servers:

POST <url>
Content-Type: application/json
<your headers>

{"name": "book_visit", "arguments": {"day": "2026-11-14", "time": "15:30", "name": "Ali"}, "room": "gvp_...", "call": "..."}

room is the call's room: the same room that POST /v1/voice/calls answered for a call your code started, so your endpoint can tell which call (and which client) it is about. Whatever the endpoint answers with a 2xx status, JSON or text, goes to the model as the function's result. A non-2xx answer or a timeout reaches the model as {"error": "..."}.

Limits: 8 functions an agent; url is HTTPS on a public host; name is 2 to 40 lower-case Latin letters, digits or _; up to 5 headers; timeout_ms 1,000 to 15,000 (default 8,000). Header values are never shown again: the API answers *** for them, and *** sent back in a PUT keeps the stored value.

Three things the platform does itself. A function is offered to the model only after the caller has said something: nothing is called at the greeting or while the line is silent, so what is known before the call belongs in variables. One reply may call functions in up to three steps, one after another, before it speaks. And your endpoint receives only the argument names the function's parameters declare.

Function calling is new on this platform. The default model was trained to call a function when a fact has to come from records, but do not assume: confirm on a test call that the agent calls your function when it should, and that it does not when it should not.

Handing a caller over to a person ​

With transfer set, the agent has one more function on phone calls, transfer_to_human, which the platform itself answers: the agent tells the caller it is connecting them, the caller is transferred to to through the same phone line, and the agent's part of the call ends (end_reason: "transferred"). If the person does not pick up, the caller comes back to the agent as a new call. when is read by the model, so write it as a moment: "when the caller asks for a person, or complains, or wants something this instruction does not cover". Say the same in the instruction, with the words to use ("Sizni mutaxassisimizga ulayman"). A test call from the cabinet's page is not a phone call and cannot be handed over: this needs a call on a connected number. Agree with the customer who answers that number and at what hours; outside them the instruction should offer a call back instead.

Calls ​

bash
# the agent calls a phone (through a number connected in the project; a real, paid call)
curl -s -X POST "$GAPI_URL/v1/voice/calls" -H "Authorization: Bearer $GAPI_TOKEN" -H "Content-Type: application/json" \
  -d '{"agent_id": "<id>", "to": "<phone number>", "variables": {"client_name": "Ali"}}'

The answer holds the call's id and room; the call is created, then active once the phone was answered, then ended, or failed with an end_reason (busy, no_answer, declined, wrong_number, ...). GET /v1/voice/calls lists the project's calls with status, duration and reason; DELETE /v1/voice/calls/{id} ends one. Every call is recorded: a few seconds after it ends the call shows "recording": true and GET /v1/voice/calls/{id}/recording returns the WAV (the other side on the left channel, the agent on the right). Calls that come in on a connected number are answered by the agent chosen for that number in the cabinet. GET /v1/voice/lines lists the connected numbers and whether each is registered with its provider.

On a call the agent places, the platform ends the instruction with one line saying that the agent is the one who rang. It does not say why: an instruction written for answering calls makes the agent greet the client it has just rung as a reception desk would (on a check, 117 of 200 openings; with the name passed as a variable it was used in a third of them). Write a separate agent for calls out, whose instruction opens with who is calling whom and why.

A few seconds after a call ends it also shows "transcript": true and outcome (how the agent's side says the talk ended: agreed, declined, callback, ...); GET /v1/voice/calls/{id}/transcript returns the text turn by turn.

A project places at most three phone calls at once: a fourth POST /v1/voice/calls with to answers 429 voice_project_limit until one of them ends. Pace a list accordingly.

Calling a list of people: the Studio ​

When the business wants a list called (feedback after a purchase, new leads, reminders, a win-back), do not write the queue yourself. Gapi Voice Agent Studio is an open shell for exactly this, run on the business's own machine: https://github.com/Islomov49/gapi-voice-studio. It keeps agents with versions, makes a test call to the business's own tester the gate before any campaign, calls an Excel list in portions inside calling hours with retries and a stop list, and shows each call's recording, text and form. It connects to Bitrix24 and amoCRM by itself: the cards at a pipeline stage become the people to call, and each result is written back onto its card (a comment, another stage, a to-do for the card's manager); the person enters the CRM's key in the Studio's interface, not in your chat. It has a web interface for the person and an MCP server for you, whose tools pass the same checks.

bash
git clone https://github.com/Islomov49/gapi-voice-studio && cd gapi-voice-studio
GAPI_TOKEN="$GAPI_TOKEN" docker compose up -d      # then http://localhost:8090 for the person
claude mcp add --transport http gapi-studio http://localhost:8090/mcp     # or: codex mcp add gapi-studio --url http://localhost:8090/mcp

Its AGENTS.md is your working guide there: read it before the first tool call. Ask the person before you install or start anything on their machine.

Transcribing the business's recorded calls ​

The same token transcribes recordings (Uzbek, with Russian mixed in), which is how you read calls the business already has. Speaker separation and marking who is the client and who the manager are options of a request, at no extra charge (settings, see options.html):

bash
curl -s -X POST "$GAPI_URL/v1/jobs" -H "Authorization: Bearer $GAPI_TOKEN" -F file=@call.mp3     # -> {"id", "result_url", ...}
curl -s "$GAPI_URL/v1/jobs/<id>" -H "Authorization: Bearer $GAPI_TOKEN"                          # until "state": "done"
curl -s "$GAPI_URL/v1/jobs/<id>/result" -H "Authorization: Bearer $GAPI_TOKEN"                   # text and segments with speakers

POST /v1/transcribe answers at once for a recording of up to five minutes. While the platform is in beta every account's balance is topped up each midnight (Tashkent) to four hours of audio, free; GET /v1/usage says how much is left today (remaining_seconds). Set the project's vocabulary first (PUT /v1/vocabulary), so that the business's names come out right in the text. Details: $GAPI_URL/docs/en/quickstart.html, .../api.html, .../options.html.

How to approach a setup ​

Work it out for this business and this codebase; the following is what to think about, not a script.

Learn the business first, ask second. Read what the repository and the customer's material already say: README, site texts, price lists, FAQ, CRM models and field names, existing call scripts, support macros. Then ask the customer only what you could not find, in their language, a few questions at a time. You need to end up knowing: who the agent is (a name, a role, the company as people say it aloud, address, hours); whether clients call in or the agent calls out, and why; the one outcome a call should end with; the facts it may state (services, prices, terms, offers with end dates, and what the business does not offer); what it must never promise; what it does when it cannot help (what to collect, what call back to promise); the callers' language and the company's manner; and the business's names, for the vocabulary.

If the business already takes or makes such calls, read them. Nothing tells you more than real calls: what clients actually ask and in what words, which objections come up and how often, how the best operator answers them, how a good call ends and where a bad one breaks, how long a call is, which names are said. Ask the customer whether they have recordings (their telephony or CRM usually keeps them) or transcripts. With transcripts, read a spread of them. With recordings only, transcribe a sample with Gapi itself (above): twenty to thirty calls of the kind the agent will handle, across different days and operators, good ones and bad ones, is enough to see the patterns, and fits well inside the free daily four hours; check GET /v1/usage before a larger batch. Recordings hold the business's clients' personal data: get the customer's word before you upload any, keep transcripts out of the repository and out of your replies beyond short paraphrased examples, and delete your working copies when you are done. Take from them the agent's goal as it really is, the facts clients ask about, the rules for the objections that really occur (with the wording that worked), the vocabulary, and realistic test phrases for the customer's test call.

Decide what belongs where. Stable knowledge goes into the instruction. Names go into the vocabulary as well. What differs per client and is known before the call (their name, what they ordered, why you are calling) is a variable your code fills. What has to be fresh, or has to change something (free hours, an order's status, a booking), is a function. A small business with a fixed price list may need no function at all; do not build integration the call does not need.

Choose the settings for this kind of call, rather than leaving them all as they come. A few starting points: a call the agent places should open with the agent (first_speaker: agent) and say who is calling and why at once; a reception line may do the same or wait for the caller. Older callers and people reading out numbers pause mid-sentence: raise patience (1.2 to 1.5) for them, lower it (0.8) for quick routine calls. Keep interruptions on unless the agent must read something out whole (a legal notice). silence_seconds at 6 to 10 suits most calls; turn it off only where silence is expected (the caller is looking something up). Set max_duration_seconds to what the goal needs plus a margin, not to the platform's limit. conversational speech fits calls with clients in Tashkent; literary fits official notices. These are starting points: the calibration below settles them.

Find where it plugs into their code. Where does a call start (a new request on the site, a missed call, a reminder job, a status change in the CRM)? What does that place know about the client that the agent should know? Where can the functions' endpoint live, how is it deployed, how are its secrets kept, and what in their data model do "book" or "look up" really mean? Propose the integration to the customer in a few lines before building it.

Build the functions' endpoint as you would any public endpoint. Authenticate every request with the header secret. Validate the arguments: the model can pass a wrong date or a made-up id. Make writes safe to repeat. Answer fast: the caller is waiting in silence, so aim for well under two seconds and return less rather than more. Answer with small JSON that says what the agent needs to say next ({"booked": true, "day": "...", "time": "..."}, {"free": ["10:00", "15:30"]}, {"error": "that hour is taken", "free": [...]}); an error the model can read is better than a 500. Log each request with its room.

Write the instruction (the section after next), including when to use each function and what to say when one fails.

Verify what you can yourself, and say what you could not. At the least:

  • the agent as the API holds it (GET /v1/voice/agents) is what you meant;
  • the prompt with realistic variables reads right (POST .../prompt), and with the defaults alone;
  • the functions' endpoint, sent exactly the request above with the header, does the right thing for good arguments, bad arguments, a repeated request and a wrong secret, within the time limit, from the public internet;
  • the code that starts calls builds the right request (without placing a call, unless the customer said to).

Then the customer listens. You cannot hear the agent. Ask the customer to open the cabinet, the project, "Voice agents", choose the agent and press the call button (it goes through their microphone, with the text of both sides on the page), and to try what callers really say, the awkward things included. If the agent has functions, watch your endpoint's log while they talk. Ask what went wrong in their words and fix the cause (the table in the next section).

Hand over. Tell the customer what exists now: the agent (its name and id), the vocabulary, the variables and functions and where their code is, how calls are started, what you tested and what only they can test; that the token in the task can be revoked on the cabinet's "Tokens" page once you are done; and that the agent should be calibrated after its first five to ten real calls, which they can ask you for with the second task in the cabinet.

Calibrate after the first five to ten calls ​

A setup made before any real call is a guess. Once the agent has taken five to ten real calls, go over them once; after that, again whenever something changes (a new offer, a new kind of caller, complaints).

What you have to go on: the calls themselves (GET /v1/voice/calls: how long each lasted and how it ended), your functions' log (what the agent asked for, with what arguments, when), the customer, who heard the calls or heard about them, and, where the customer's telephony records its calls, the recordings of the agent's own calls, which you can transcribe as above and read like any other call. Ask the customer first what was wrong, and for two or three concrete moments. Then look for patterns rather than single calls:

What the calls showWhat to change
Many calls of a few seconds ending with the caller leavingThe opening: the first sentence does not say who is calling and why, or the agent waits when it should speak (first_speaker)
The agent answers before the caller has finished, or talks over pausesRaise patience by 0.2
Long silences before every replyLower patience by 0.2; shorten function answers; check the endpoint's response time
The agent keeps asking "are you there?"Raise silence_seconds, or turn it off for calls where the caller looks things up
Callers cannot get a word ininterruptions: true; shorter replies in the instruction
Calls reach the time limitThe goal is too large for one call, or the agent does not close: rewrite the ending; only then raise max_duration_seconds
A name is written or said wrong, the agent asks to repeat itAdd it to the vocabulary (the project's, if every agent needs it)
The agent said something untrueThe fact is missing, or written twice in two ways: keep it once
The agent ignored a ruleRewrite the rule with its moment and its words
A function was not called, or at the wrong momentIts description, and a rule in the instruction naming the moment
A function was called with wrong argumentsDescribe each argument (format, example); validate and answer with an error the model can read
Calls end without the goal though nothing went wrongThe goal or the ending is unclear: one outcome, two exact options to choose from, the agreement repeated

Change one thing at a time where you can, tell the customer what you changed and why, and look again after the next five to ten calls. If a change made things worse, put the old value back: keep the previous agent's JSON before each PUT.

Writing the instruction ​

Start from a measured template when one fits: /docs/agent-templates.md holds eight whole instructions (a call to a new lead, a follow-up after an offer, bringing a past client back, a reminder of an appointment, a feedback call, a payment reminder, reception, support). In a template only the first paragraph (who the agent is) and the list under Ma'lumotlar (the facts it may state) are the business's; keep the script below them unless the customer's calls go otherwise. For the Operator LLM the platform appends the model's own call protocol (how a reply is written, how the call ends) and today's date to every instruction: do not write those yourself.

Write it in the language the callers speak (Uzbek unless told otherwise), as plain text addressed to the agent ("Siz ..."). No markdown headings, no tables; short labelled paragraphs and dash lists are fine. An order that works:

  1. Identity: name, role, company, address, working hours.
  2. Situation and goal: who is calling whom and why; the one outcome a call should end with.
  3. Facts: what the agent may state, with numbers; then what to say about anything that is not on the list.
  4. Rules: each names a moment and what to do or say then.
  5. Functions, if any: when to call each, and what to say if it answers with an error.
  6. Manner: one or two sentences a reply, one question at a time, the language rule.
  7. The ending: offer two exact times, repeat what was agreed, say goodbye.
  8. Being an AI: if asked directly, the agent says it is the company's AI assistant.

Rules the agent keeps:

  • Name the moment. "When the client says it is cheaper elsewhere, ..." is kept; "be persuasive about price" is not.
  • Give the words when a phrase matters, in quotes.
  • Tie a condition to an action: "do not offer a discount until the client has said what they compare with".
  • Replace a count with named moments: not "mention the offer twice", but "after the price, and again before saying goodbye".
  • A trait of character ("friendly", "confident") does little on its own; say what it changes in a reply.
  • One fact, one place.

What a voice needs that a chat does not: replies are heard, so no lists, links or anything that only makes sense on a screen; addresses, prices and times as a person would say them; one question at a time; the first sentence says who is calling and why. Every name in the instruction that a caller may say back belongs in the vocabulary too.

An example to adapt, not to copy (a dental clinic's reception, calls coming in, with one function):

Siz Malikasiz, “Namuna” stomatologiya klinikasining qabulxona operatorisiz. Manzil: Toshkent, Chilonzor tumani,
Bunyodkor ko‘chasi, 12-uy. Ish vaqti: dushanbadan shanbagacha 9:00 dan 19:00 gacha, yakshanba dam olish kuni.

Vaziyat: mijoz klinikaga o‘zi qo‘ng‘iroq qilyapti.
Maqsad: nima kerakligini aniqlab, shifokor qabuliga aniq kun va soatga yozib qo‘yish.

Ma’lumotlar:
- Birinchi ko‘rik va maslahat: 100 000 so‘m, 30 daqiqa.
- Tish oqartirish: 1 200 000 so‘m, ikki soat.
- Bo‘lib to‘lash yo‘q, to‘lov qabuldan keyin naqd yoki karta orqali.
Bu ro‘yxatda yo‘q narx yoki xizmat haqida so‘rashsa, o‘ylab topmang: “Aniqlab, sizga qayta qo‘ng‘iroq qilamiz” deng.

Qoidalar:
- Mijoz narx qimmat desa, darhol chegirma taklif qilmang: avval nima bilan solishtirayotganini so‘rang.
- Mijoz shikoyat qilsa yoki shifokor bilan gaplashmoqchi bo‘lsa, ismi va telefon raqamini so‘rang va bir soat ichida
  qayta qo‘ng‘iroq qilishlarini ayting.
- Tashxis qo‘ymang va dori tavsiya qilmang: “Buni shifokor ko‘rikda aytadi” deng.

Funksiyalar:
- Mijoz kun va soatga rozi bo‘lib, ismini aytgandan keyin book_visit funksiyasini chaqiring. U xato qaytarsa,
  uzr so‘rang va javobdagi bo‘sh vaqtlardan birini taklif qiling.

Suhbat: har javob bir-ikki gap bo‘lsin, bir vaqtda bitta savol bering. Mijoz qaysi tilda gapirsa, o‘sha tilda javob bering.
Oxirida kelishilgan kun, soat va mijozning ismini takrorlang, keyin xayrlashing.
To‘g‘ridan-to‘g‘ri so‘rashsa, klinikaning sun’iy intellekt yordamchisi ekaningizni ayting.

Its vocabulary: ["Namuna", "Bunyodkor", "Chilonzor", "Malika"].

If the API is not reachable ​

Give the customer the instruction in one code block, the vocabulary and the simple settings as a short list, and tell them where it goes: cabinet, project, "Voice agents", "New agent", the field "Instructions for the agent". Variables and functions need the API; say so.

More ​

  • The same guidance for people, with reasons: $GAPI_URL/docs/en/agents.html (Russian /docs/ru/agents.html, Uzbek /docs/agents.html).
  • The API in general (tokens, errors, limits): $GAPI_URL/docs/en/api.html.