API GuidesNov 6, 2026·7 min read

Use Shomoy AI API Like a Groq/OpenAI Key: Full Setup Guide

Your sai_ key speaks the OpenAI chat format — drop it into n8n, LangChain or any OpenAI-compatible tool. Full setup plus a troubleshooting table for every error.

A
ABM Ataullah
Founder, Shomoy

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):

ItemValueWhere it goes
API keysai_…The Authorization: Bearer header of every request
Base URLhttps://voice.shomoy.io/v1The "Base URL" field of any OpenAI-compatible client
Modelbangla-replyThe 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.

  1. In n8n open Credentials → New → OpenAI.
  2. API Key: paste your sai_… key.
  3. 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.
  4. 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.
  5. 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:

  1. Facebook Trigger (or Webhook) on page feed events → an IF node keeps only item == "comment", verb == "add", and from.id != your page ID. That last check is mandatory — without it the bot answers its own replies forever.
  2. HTTP Request → POST https://voice.shomoy.io/v1/chat/completions with 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}}"}]}
  3. HTTP Request → POST https://graph.facebook.com/v21.0/{{comment_id}}/comments with {"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") then chat.completions.create() exactly as usual.

Troubleshooting — every error and what it means

What you seeCauseFix
401 unknown or disabled keyWrong/missing key, an inactive subscription, or a wgt_… widget keySend Authorization: Bearer sai_… in the header (never in the URL). Widget keys only work on /v1/reply, not on chat completions.
429 monthly quota exhaustedThe plan's reply count for this month is used upCheck quota_left on earlier calls; upgrade on the shop page or wait for the monthly reset.
502 upstream failedA model provider in the chain rate-limited after retriesRetry after a few seconds. In n8n enable the node's "Retry on fail" — under heavy load upstream capacity can dip briefly.
400 messages[] requiredBody was not the OpenAI shapeSend {"model":"…","messages":[{"role":"user","content":"…"}]} as JSON with Content-Type: application/json.
413 request too largeBody over 4 MBTrim long context; the API keeps the last 50 messages anyway.
Empty model dropdown in n8nClient could not fetch the model listType bangla-reply manually — the endpoint GET /v1/models exists but some tools skip it.
"Credentials test failed" in n8nBase URL missing or missing /v1Use exactly https://voice.shomoy.io/v1 — including the /v1 suffix.
stream:true gives one JSON, not chunksStreaming SSE is not supported yetRemove the stream flag; clients that require SSE are not compatible yet.
Reply ignores your business factsYou called /v1/chat/completionsThe 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 neededWrong endpointUse POST /v1/reply with audio_b64 — it transcribes, replies and returns mp3. Chat completions is text-only.
Slow first responseCold upstream in the fallback chainNormal 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 logsKey placed inside a URL or body fieldKeep 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, extractPOST /v1/chat/completions
Customer replies from your business profile, with memory + lead capturePOST /v1/reply
Voice note → spoken Bangla replyPOST /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.

Frequently asked questions

+

+

+

+

+

+

#API Guide#n8n#Developers

Continue reading

📘Automation

ফেসবুক পেজ অটো রিপ্লাই মেসেজ বাংলা সেটআপ গাইড

ফেসবুক পেজে আসা কাস্টমার মেসেজের উত্তর দিতে ব্যস্ত? শিখে নিন কীভাবে AI এবং n8n দিয়ে বাংলায় অটো রিপ্লাই সেটআপ করতে হয়।

⚙️n8n Tutorial

n8n দিয়ে নতুন অর্ডারে WhatsApp নোটিফিকেশন: ধাপে ধাপে গাইড

ওয়েবসাইট বা ফর্মে নতুন অর্ডার এলে n8n নিজে থেকেই কাস্টমারকে ধন্যবাদ মেসেজ পাঠাবে। তিনটি নোডের ছোট একটা workflow, স্ক্রিনশট দেখে ১৫-২০ মিনিটে বানানো যায়।

💬Facebook Automation

ফেসবুক কমেন্টে অটো রিপ্লাই: প্রতিটি ক্রেতাকে সেকেন্ডেই উত্তর দিন

কমেন্টে 'দাম কত?' লিখলেই কাস্টমার সেকেন্ডেই পায় আপনার আসল দামের উত্তর — বাংলা, বাংলিশ বা ইংরেজিতে। ছোট ব্যবসার জন্য মাসে মাত্র ৳৫০০ থেকে।