Your Shomoy AI API key works exactly like a Groq or OpenAI API key — the key is the only thing you need for any AI task (write, translate, summarise, classify, extract). Paste it into any tool that accepts an OpenAI-compatible endpoint and it just works. Extra credentials only come in when you connect a third-party platform like Facebook — those belong to Meta, not to us. This guide takes you from zero to a working call, then a full n8n setup, then a troubleshooting table for every error you might hit.
What do you actually get?
When your plan is active you receive three things on your account page (Shomoy AI API):
| Item | Value | Where it goes |
|---|---|---|
| API key | sai_… | The Authorization: Bearer header of every request |
| Base URL | https://voice.shomoy.io/v1 | The "Base URL" field of any OpenAI-compatible client |
| Model | bangla-reply | The model field (any name is accepted — requests are routed to the Bangla-optimised chain) |
Under the hood your calls are routed through a balanced chain of models tuned for correct Bangla, Banglish and English — the same engine that powers our own customer-facing products. You never manage model names, fallbacks or provider keys; that is the point.
Step 1 — Test it in 30 seconds
Before touching any tool, prove the key works with one request:
curl -X POST https://voice.shomoy.io/v1/chat/completions \
-H "Authorization: Bearer YOUR_SAI_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"bangla-reply","messages":[{"role":"user","content":"Say hello in one Bangla sentence"}]}'
A healthy response is a standard OpenAI completion plus one extra field:
{"choices":[{"message":{"role":"assistant","content":"Hello! ..."}}],
"usage":{"total_tokens":112}, "quota_left":2998}
quota_left tells you how many replies remain this month — every call counts 1 against your plan (a voice reply on /v1/reply counts 2). If you see this JSON, everything below will work.
Step 2 — Add it to n8n (the common case)
Shortcut — import the ready workflow: instead of building by hand, import https://voice.shomoy.io/n8n-facebook-comment-reply.json in n8n (⋯ → Import from URL). You fill in only your sai_… key, Meta app credentials and a page token — it then replies to every new comment using your business-profile reply.
- In n8n open Credentials → New → OpenAI.
- API Key: paste your
sai_…key. - Base URL:
https://voice.shomoy.io/v1— this is the field people most often forget. Without it n8n talks to api.openai.com and your key will be rejected. - Save. In any workflow add an OpenAI Chat Model node (inside an AI Agent, Basic LLM Chain, or standalone), pick your credential, and set the model to
bangla-reply. If the model dropdown cannot fetch the list, just type the name manually. - Run the node once — the response is a normal assistant message ready for the next node.
Example: reply to a Facebook comment
This is the one case needing more than your API key — reading and posting comments belongs to Meta, so you also bring a Meta app and a page token. A minimal production flow looks like this:
- Facebook Trigger (or Webhook) on page
feedevents → an IF node keeps onlyitem == "comment",verb == "add", andfrom.id != your page ID. That last check is mandatory — without it the bot answers its own replies forever. - HTTP Request →
POST https://voice.shomoy.io/v1/chat/completionswith the Bearer key and a body that injects context:{"model":"bangla-reply","messages":[ {"role":"system","content":"You reply to Facebook comments for <your business>. Prices: ... Reply in the commenter's language, max 2 sentences."}, {"role":"user","content":"{{$json.value.message}}"}]} - HTTP Request →
POST https://graph.facebook.com/v21.0/{{comment_id}}/commentswith{"message":"{{reply text}}"}and your page token.
Want replies written from your saved business profile, with lead capture and per-customer memory, instead of a system prompt? Same flow, but call POST /v1/reply with {"text":"…","session":"fb-{{commenter id}}"} — the response field is reply instead of the OpenAI shape.
Step 3 — Any other OpenAI-compatible tool
The same three values work anywhere a tool accepts a custom OpenAI endpoint:
- LangChain / LlamaIndex:
ChatOpenAI(api_key="sai_…", base_url="https://voice.shomoy.io/v1", model="bangla-reply") - Continue, LibreChat, Open WebUI: add an OpenAI provider with that base URL and key.
- Plain Python:
OpenAI(api_key=…, base_url="https://voice.shomoy.io/v1")thenchat.completions.create()exactly as usual.
Troubleshooting — every error and what it means
| What you see | Cause | Fix |
|---|---|---|
401 unknown or disabled key | Wrong/missing key, an inactive subscription, or a wgt_… widget key | Send Authorization: Bearer sai_… in the header (never in the URL). Widget keys only work on /v1/reply, not on chat completions. |
429 monthly quota exhausted | The plan's reply count for this month is used up | Check quota_left on earlier calls; upgrade on the shop page or wait for the monthly reset. |
502 upstream failed | A model provider in the chain rate-limited after retries | Retry after a few seconds. In n8n enable the node's "Retry on fail" — under heavy load upstream capacity can dip briefly. |
400 messages[] required | Body was not the OpenAI shape | Send {"model":"…","messages":[{"role":"user","content":"…"}]} as JSON with Content-Type: application/json. |
413 request too large | Body over 4 MB | Trim long context; the API keeps the last 50 messages anyway. |
| Empty model dropdown in n8n | Client could not fetch the model list | Type bangla-reply manually — the endpoint GET /v1/models exists but some tools skip it. |
| "Credentials test failed" in n8n | Base URL missing or missing /v1 | Use exactly https://voice.shomoy.io/v1 — including the /v1 suffix. |
stream:true gives one JSON, not chunks | Streaming SSE is not supported yet | Remove the stream flag; clients that require SSE are not compatible yet. |
| Reply ignores your business facts | You called /v1/chat/completions | The business profile applies to /v1/reply only. Chat completions is the raw general model — put facts in the system message or use /v1/reply. |
| Voice note in, audio out needed | Wrong endpoint | Use POST /v1/reply with audio_b64 — it transcribes, replies and returns mp3. Chat completions is text-only. |
| Slow first response | Cold upstream in the fallback chain | Normal calls land in about 0.5–4 s. If a call exceeds your client timeout, raise the timeout rather than spamming retries. |
| Key visible in n8n execution logs | Key placed inside a URL or body field | Keep it only in the credential's API Key field — credentials are stored encrypted and masked in logs. |
Which endpoint for which job?
| You want… | Use |
|---|---|
| General AI in n8n/agents — write, translate, classify, extract | POST /v1/chat/completions |
| Customer replies from your business profile, with memory + lead capture | POST /v1/reply |
| Voice note → spoken Bangla reply | POST /v1/reply with audio_b64 |
| Update your business facts (prices, policies) | PUT /v1/profile |
Plans and limits
Starter is ৳500/month for 3,000 replies; Business is ৳1,500/month for 15,000 — enough for a busy automation that touches every comment and message on a page. Payment is bKash; activation happens after your payment is approved. See current plans on the product page.
One honest limitation to design around: this is a single key with one monthly counter. If you run several heavy n8n workflows on the same key they share the quota — watch quota_left in responses and route low-priority jobs elsewhere or upgrade before the counter runs dry.