কণ্ঠ REST API দিয়ে আপনার নিজের সার্ভার বা অ্যাপ থেকে বাংলা লেখা পাঠিয়ে অডিও (WAV অথবা MP3) বানানো যায়, তারপর ফাইলটা নিজের সিস্টেমে নামিয়ে নেওয়া যায়। এতে আপনার কণ্ঠ-ক্লোন করা ভয়েস, তৈরি ২৪টি কণ্ঠ আর আঞ্চলিক টান সবই চলে। অনুমতি দেয় একটি অ্যাপ্লিকেশন কী; উত্তর আসে JSON-এ।

৩ ধাপে শুরু

  1. কী বানান। সাইন আপ করে যেকোনো একটি প্যাকেজ কিনুন (API ব্যবহারের জন্য একবার কেনা লাগে), তারপর ড্যাশবোর্ডের “API ও MCP” ট্যাবে কী বানান। কীটি kontho_sk_… দিয়ে শুরু; এটি শুধু একবার দেখানো হয়, তাই কপি করে নিরাপদ জায়গায় রাখুন।
  2. অডিও বানান। POST /v1/speech-এ লেখা পাঠান। উত্তরে অডিওর আইডি, সময় আর কত ক্রেডিট কাটল তা আসে।
  3. ফাইল নামান। GET /v1/speech/{id}/audio থেকে WAV নিন (MP3 চাইলে শেষে ?format=mp3)। অথবা প্রথম অনুরোধেই Accept: audio/wav বা audio/mpeg দিন, তাহলে সরাসরি ফাইলটাই ফেরত আসবে।

সব অনুরোধে হেডারে Authorization: Bearer <আপনার কী> দিন। API ডাকুন আপনার সার্ভার থেকে, ওয়েব পেজের ভেতর থেকে নয়: ব্রাউজারে কী রাখলে যে কেউ সেটা দেখে ফেলতে পারে, তাই এই API ব্রাউজারকে উত্তর পড়তেই দেয় না।

The Kontho REST API lets your own server or app send Bangla text, make audio (WAV or MP3) and download the file into your own system. It works with voices you cloned, the 24 ready-made voices and every regional accent. An application key is the permission; answers come as JSON.

Start in 3 steps

  1. Make a key. Sign up, buy any package (the API needs one purchase), then make a key in the dashboard tab “API ও MCP”. It starts with kontho_sk_… and is shown only once, so copy it somewhere safe.
  2. Make audio. Send the text to POST /v1/speech. The answer has the audio id, its length and how many credits it cost.
  3. Download the file. Get the WAV from GET /v1/speech/{id}/audio (add ?format=mp3 for an MP3). Or send Accept: audio/wav or audio/mpeg with the first request and the file comes straight back.

Send Authorization: Bearer <your key> with every request. Call the API from your server, not from inside a web page: a key in a browser can be seen by anyone, so this API does not let browsers read its answers.

কোড উদাহরণ

curl

curl https://kontho.net/v1/speech \
  -H "Authorization: Bearer $KONTHO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001" \
  -d '{"text":"আমি বাংলায় কথা বলি।","voice_id":"builtin:nila","quality":"fast"}'

curl https://kontho.net/v1/speech/123/audio \
  -H "Authorization: Bearer $KONTHO_API_KEY" -o hello.wav

curl (MP3)

curl https://kontho.net/v1/speech \
  -H "Authorization: Bearer $KONTHO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: audio/mpeg" \
  -d '{"text":"আমি বাংলায় কথা বলি।","format":"mp3"}' -o hello.mp3

Node.js (18+)

import { writeFile } from 'node:fs/promises';

const key = process.env.KONTHO_API_KEY;
const res = await fetch('https://kontho.net/v1/speech', {
  method: 'POST',
  headers: { Authorization: `Bearer ${key}`, 'Content-Type': 'application/json', 'Idempotency-Key': 'order-1001' },
  body: JSON.stringify({ text: 'আমি বাংলায় কথা বলি।', voice_id: 'builtin:nila' }),
});
const speech = await res.json();
if (!res.ok) throw new Error(`${speech.error.code}: ${speech.error.message}`);

const wav = await fetch(speech.audio_url, { headers: { Authorization: `Bearer ${key}` } });
await writeFile('hello.wav', Buffer.from(await wav.arrayBuffer()));

Python

import os, requests

key = os.environ["KONTHO_API_KEY"]
auth = {"Authorization": f"Bearer {key}"}
r = requests.post("https://kontho.net/v1/speech",
                  headers={**auth, "Idempotency-Key": "order-1001"},
                  json={"text": "আমি বাংলায় কথা বলি।", "voice_id": "builtin:nila"},
                  timeout=600)  # a long text can take minutes
r.raise_for_status()
speech = r.json()
open("hello.wav", "wb").write(requests.get(speech["audio_url"], headers=auth).content)

প্রতিটি কল একটি মেশিন-পাঠযোগ্য ফাইলে বর্ণনা করা আছে: openapi.json (OpenAPI 3.1)

সব কল

GET /v1/balanceকত ক্রেডিট বাকি। বিনামূল্যে।
GET /v1/voicesআপনার ক্লোন করা ও তৈরি কণ্ঠ, আঞ্চলিক টান, বলার ধরন, মানের দাম। বিনামূল্যে।
POST /v1/text/fixসংখ্যা, তারিখ, চিহ্ন বাংলা শব্দে লেখা; চাইলে আঞ্চলিক টানে। সর্বোচ্চ ২,০০০ অক্ষর। বিনামূল্যে।
POST /v1/speech/estimateএকটি লেখায় কত ক্রেডিট লাগবে। বিনামূল্যে।
POST /v1/speechঅডিও বানায়। ১ সেকেন্ডে ১ ক্রেডিট (HQ হলে ২)।
GET /v1/speechসাম্প্রতিক অডিওর তালিকা (limit, before)। বিনামূল্যে।
GET /v1/speech/{id}একটি অডিওর পুরো তথ্য ও লগইন ছাড়া ডাউনলোড লিংক। বিনামূল্যে।
GET /v1/speech/{id}/audioWAV ফাইল, বা ?format=mp3 দিলে MP3 (Range চলে)। বিনামূল্যে।

POST /v1/speech-এর ফিল্ড: text (দরকারি), voice_id (builtin:nila বা নিজের কণ্ঠের নম্বর), style, dialect, quality (fast বা hq), format (wav বা mp3), fix_text (true দিলে আগে লেখা ঠিক করে নেয়)। সব বিকল্পের তালিকা GET /v1/voices-এ আছে।

GET /v1/balanceCredits left. Free.
GET /v1/voicesYour cloned voices, the ready-made voices, accents, speaking styles and quality prices. Free.
POST /v1/text/fixWrites numbers, dates and symbols as Bangla words; optionally in a regional accent. Up to 2,000 characters. Free.
POST /v1/speech/estimateWhat a text would cost. Free.
POST /v1/speechMakes audio. 1 credit per second (HQ: 2).
GET /v1/speechRecent audio (limit, before). Free.
GET /v1/speech/{id}Full details of one audio and a download link that needs no key. Free.
GET /v1/speech/{id}/audioThe WAV file, or the MP3 with ?format=mp3 (Range works). Free.

Fields of POST /v1/speech: text (required), voice_id (builtin:nila or the number of your own voice), style, dialect, quality (fast or hq), format (wav or mp3) and fix_text (true fixes the text for speech first). GET /v1/voices lists every option.

সীমা আর জেনে রাখুন

  • লেখার দৈর্ঘ্য: প্রতি কলে সর্বোচ্চ ৫,০০০ অক্ষর (fix_text দিলে ২,০০০)। তবে ২,৫০০ অক্ষরের বেশি এক কলে না দেওয়াই ভালো: বড় লেখায় কয়েক মিনিট লাগে, আর আপনার প্রোগ্রাম আগে থেমে গেলে সেই অডিও হারিয়ে যেতে পারে। বড় স্ক্রিপ্ট কয়েক ভাগ করে পাঠান, তারপর WAV ফাইলগুলো জুড়ে নিন।
  • খরচ: অডিওর আসল দৈর্ঘ্য ধরে ১ সেকেন্ডে ১ ক্রেডিট, HQ হলে ২। আগে দেখতে চাইলে POST /v1/speech/estimate। ব্যর্থ হলে কিছু কাটে না।
  • পুনরায় চেষ্টা নিরাপদ: প্রতিটি অডিওর জন্য একটি নতুন Idempotency-Key (১–৬৪ অক্ষর: ইংরেজি অক্ষর, সংখ্যা, -, _) দিন। কল থেমে গেলে একই লেখা আর একই কী দিয়ে আবার পাঠান: প্রথম উত্তরটাই ফেরত আসবে (Idempotent-Replayed: true), ক্রেডিট দ্বিতীয়বার কাটবে না। কী প্রায় ২৪ ঘণ্টা মনে রাখা হয়।
  • হার সীমা: অডিও বানানো মিনিটে ১০টি, ঘণ্টায় ৩০০টি, দিনে ২,০০০টি; সব কল মিলিয়ে মিনিটে ৩০০টি; ভুল কী ১৫ মিনিটে ৩০ বার। সীমা পেরোলে 429 আর Retry-After হেডার আসে।
  • ফাইল ৩০ দিন থাকে। তারপর মুছে যায় (410 AUDIO_EXPIRED)। বানানোর পরেই নামিয়ে নিজের সিস্টেমে রাখুন।
  • ফরম্যাট: WAV (ডিফল্ট; ২৪ kHz, মনো, ১৬-বিট) অথবা MP3 (১২৮ kbps, মনো)। MP3 চাইতে "format":"mp3" দিন (ডাউনলোডে ?format=mp3; Accept: audio/mpeg দিলে সরাসরি MP3 ফাইল আসে)। MP3-র জন্য আলাদা ক্রেডিট লাগে না। কোনো অডিওর প্রথম MP3 বানাতে একটু সময় লাগে (মিনিটপ্রতি প্রায় ১ সেকেন্ড), তারপর সেটি রেখে দেওয়া হয় এবং WAV-এর সাথেই ৩০ দিন পর মুছে যায়। ওয়েবসাইটে লম্বা স্ক্রিপ্ট থেকে বানানো অডিওর MP3 হয় না।
  • কী গোপন রাখুন। কী ফাঁস হলে ড্যাশবোর্ড থেকে বাতিল করে নতুন বানান। প্রতিটি সিস্টেমের জন্য আলাদা কী নিন।
  • প্রতিটি অডিওতে অদৃশ্য ডিজিটাল জলছাপ (SynthID) থাকে। অন্যের কণ্ঠ ক্লোন করা নিষেধ। কণ্ঠ ক্লোন করতে হয় ওয়েবসাইটে (সম্মতির রেকর্ডিংসহ), API দিয়ে নয়।
  • Text length: up to 5,000 characters per call (2,000 with fix_text). But please keep a call to about 2,500 characters: a long text takes minutes, and if your program gives up first that audio can be lost. Send a long script in parts and join the WAV files.
  • Cost: 1 credit per second of the real audio length, 2 for HQ. Use POST /v1/speech/estimate to see it first. A failed call charges nothing.
  • Retries are safe: send a new Idempotency-Key (1–64 characters: letters, digits, -, _) for each audio. If a call times out, send the same text with the same key again: you get the first answer back (Idempotent-Replayed: true) and the credits are not charged twice. Keys are remembered for about 24 hours.
  • Rate limits: making audio 10 a minute, 300 an hour, 2,000 a day; all calls together 300 a minute; wrong keys 30 per 15 minutes. Over the limit you get 429 and a Retry-After header.
  • Files are kept for 30 days, then deleted (410 AUDIO_EXPIRED). Download the audio right after making it and keep it in your own system.
  • Format: WAV (the default; 24 kHz, mono, 16-bit) or MP3 (128 kbps, mono). Ask for MP3 with "format":"mp3" (or ?format=mp3 on a download; Accept: audio/mpeg returns the MP3 file itself). MP3 costs no extra credits. The first MP3 of an audio takes a moment to make (about a second per minute of audio); it is then kept and deleted with the WAV after 30 days. Audio from a long script made on the website has no MP3.
  • Keep the key secret. If it leaks, revoke it in the dashboard and make a new one. Use a separate key for each system.
  • Every audio carries an invisible digital watermark (SynthID). Cloning other people's voices is not allowed. Voices are cloned on the website (with the consent recording), not through the API.

এরর

এরর এলে উত্তর এমন: {"error":{"code":"INSUFFICIENT_CREDITS","message":"…","message_bn":"…","status":402}}। কোডে code দেখুন, message মানুষের জন্য। ref নম্বর থাকলে সাপোর্টকে জানান।

401 API_KEY_REQUIRED, API_KEY_INVALIDকী নেই, ভুল, বাতিল, অথবা অ্যাকাউন্ট বন্ধ।
403 API_NEEDS_PURCHASEঅডিও বানাতে ও নামাতে একবার যেকোনো প্যাকেজ কিনতে হবে।
402 INSUFFICIENT_CREDITSক্রেডিট কম। কিছু কাটেনি।
400 TEXT_EMPTY, TEXT_TOO_LONGলেখা নেই বা সীমার বেশি লম্বা।
400 STYLE_INVALID, QUALITY_INVALID, DIALECT_INVALIDঅচেনা ধরন, মান বা টান। GET /v1/voices-এ ঠিক নামগুলো আছে।
404 VOICE_NOT_FOUNDএই কণ্ঠ আপনার অ্যাকাউন্টে নেই।
400 SCRIPT_BLOCKEDলেখায় প্রতারণায় ব্যবহারের শব্দ আছে (যেমন OTP, পিন)।
400 FORMAT_INVALID, FORMAT_UNAVAILABLEformat শুধু wav বা mp3 হতে পারে; অথবা এই অডিওর MP3 হয় না (লম্বা স্ক্রিপ্ট), WAV নিন।
400 BAD_JSON, 415 API_JSON_REQUIREDবডি JSON নয়। Content-Type: application/json দিন।
400 IDEMPOTENCY_KEY_INVALID, 422 IDEMPOTENCY_KEY_REUSED, 409 IDEMPOTENCY_IN_PROGRESSকী ঠিক নয়; আগে অন্য লেখায় ব্যবহার হয়েছে; অথবা প্রথম কলটি এখনো চলছে (একটু পরে একই অনুরোধ আবার পাঠান)।
429 RATE_LIMITEDঅনেক অনুরোধ। Retry-After সেকেন্ড অপেক্ষা করুন।
410 AUDIO_EXPIRED৩০ দিন পেরিয়ে ফাইল মুছে গেছে।
UPSTREAM, UPSTREAM_BUSY, UPSTREAM_TIMEOUT, QUOTA, QUOTA_DAILY, CONTENT_BLOCKEDভয়েস সার্ভিসে সমস্যা বা ব্যস্ত। কোনো ক্রেডিট কাটে না; একটু পরে আবার চেষ্টা করুন।

An error looks like this: {"error":{"code":"INSUFFICIENT_CREDITS","message":"…","message_bn":"…","status":402}}. Check code in your program; message is for people. If there is a ref number, give it to support.

401 API_KEY_REQUIRED, API_KEY_INVALIDThe key is missing, wrong, revoked, or the account is closed.
403 API_NEEDS_PURCHASEMaking and downloading audio needs one purchase of any package.
402 INSUFFICIENT_CREDITSNot enough credits. Nothing was charged.
400 TEXT_EMPTY, TEXT_TOO_LONGNo text, or longer than the limit.
400 STYLE_INVALID, QUALITY_INVALID, DIALECT_INVALIDUnknown style, quality or accent. GET /v1/voices lists the right names.
404 VOICE_NOT_FOUNDThis voice is not in your account.
400 SCRIPT_BLOCKEDThe text has words used in fraud (like OTP, PIN).
400 FORMAT_INVALID, FORMAT_UNAVAILABLEformat can only be wav or mp3; or this audio has no MP3 (a long script): get the WAV.
400 BAD_JSON, 415 API_JSON_REQUIREDThe body is not JSON. Send Content-Type: application/json.
400 IDEMPOTENCY_KEY_INVALID, 422 IDEMPOTENCY_KEY_REUSED, 409 IDEMPOTENCY_IN_PROGRESSThe key is not valid; it was used for a different text before; or the first call is still running (send the same request again in a little while).
429 RATE_LIMITEDToo many requests. Wait Retry-After seconds.
410 AUDIO_EXPIREDThe file was deleted after 30 days.
UPSTREAM, UPSTREAM_BUSY, UPSTREAM_TIMEOUT, QUOTA, QUOTA_DAILY, CONTENT_BLOCKEDThe voice service had a problem or is busy. No credits are charged; try again a little later.

চ্যাটবট থেকে কণ্ঠ ব্যবহার (MCP)

Claude, ChatGPT, Cursor বা Codex-এর সাথে Kontho যুক্ত করলে চ্যাটবটকেই বলতে পারেন, যেমন: “এই লাইনটা নীলার কণ্ঠে অডিও করো”। চ্যাটবট আপনার অ্যাকাউন্টের ক্রেডিটে অডিও বানায় (১ সেকেন্ডে ১ ক্রেডিট, HQ হলে ২; প্রতি অনুরোধে সর্বোচ্চ ৫,০০০ অক্ষর) আর ৩০ দিনের ডাউনলোড লিংক দেয়; লিংকের শেষে ?format=mp3 জুড়লে MP3 পাবেন। এই সংযোগে কণ্ঠ ক্লোন করা যায় না। সার্ভারের ঠিকানা: https://kontho.net/mcp।

  • Claude (ওয়েব/ডেস্কটপ): Customize → Connectors → Add custom connector → ঠিকানাটি দিন → “Allow” চাপুন। কী লাগে না।
  • ChatGPT: Settings → Connectors → Create → ঠিকানাটি দিন, Authentication: OAuth → “Allow” (কাস্টম কানেক্টরের জন্য Developer mode বা Plus/Pro প্ল্যান লাগতে পারে)।
  • Claude Code ও Codex: নিচের কমান্ড কয়েকটি চালান। Codex-এ কী লাগে না (OAuth)।
  • Cursor ও অন্যান্য টুল: ড্যাশবোর্ডের “API ও MCP” ট্যাবে বানানো একটি কী, হেডার হিসেবে।

Connect Kontho to Claude, ChatGPT, Cursor or Codex and you can simply ask the chatbot, for example: “Make this line into audio in Nila's voice”. The chatbot spends your account's credits (1 per second, HQ 2; up to 5,000 characters per request) and gives you a download link valid for 30 days; add ?format=mp3 to the end of the link for an MP3. Voices cannot be cloned through this connection. Server address: https://kontho.net/mcp.

  • Claude (web/desktop): Customize → Connectors → Add custom connector → paste the address → press “Allow”. No key needed.
  • ChatGPT: Settings → Connectors → Create → paste the address, Authentication: OAuth → “Allow” (a custom connector may need Developer mode or a Plus/Pro plan).
  • Claude Code and Codex: run the commands below. Codex needs no key (OAuth).
  • Cursor and other tools: a key made in the dashboard tab “API ও MCP”, sent as a header.
# Claude Code
/plugin marketplace add Ankabut-Software/kontho
/plugin install kontho@kontho

# Codex
codex mcp add kontho --url https://kontho.net/mcp
codex mcp login kontho

# Cursor and other tools (the key goes in the header)
{"mcpServers":{"kontho":{"url":"https://kontho.net/mcp","headers":{"Authorization":"Bearer <KEY>"}}}}

নয়টি টুল

kontho_list_voices, kontho_fix_text, kontho_estimate_cost, kontho_generate_audio, kontho_balance, kontho_recent_audio, kontho_write_content, kontho_plan_reel, kontho_get_reel

কয়েক মিনিটেই প্রথম অডিও বানান

সাইন আপেই ১০ মিনিট ফ্রি। API ব্যবহার করতে যেকোনো একটি প্যাকেজ কিনুন।

১০ মিনিট ফ্রি নিন OpenAPI ফাইল