Nimdeɛ a wɔde gyina so Akanfoɔ a wɔyɛ adwuma a wɔyɛ nneɛma foforɔ
Mfonini, nneɛ ne embeddings
App no mu nneɛma a ɛma nneɛma foforɔ ba no, ne nneɛma a yɛde hyɛ search mu: mfonini, video, kasa, nkyerɛaseɛ ne embeddings, na wɔbɛsesa wo sika a ɛwɔ wo mu wɔ nneɛma biara a wode di dwuma ho.
Wɔde mfiri na ɛkyerɛ krataafa yi ase sɛnea ɛbɛyɛ a ɛbɛyɛ mmerɛw. Engiresi kasa mu mfitiase de no ne nkyerɛase a ɛfa ho.
Mfoni a wɔregye aseɛ
Ɛyɛ mfonini baako kɔsi nane afa mfonini bi a wɔahyɛ nkyerɛkyerɛ bi ase na ɛde hyɛ wo ma wɔawie. Ɛyɛ mfonini mmoa pɛpɛɛpɛ a ɛdi so sɛ ?image amu app no mu.
POST https://nymbot.ai/api/v1/images/generations — API key tia, anaa Ɔsesɛe nnuane kɔmɔ biako koro kɔmɔ koro ho nna.
Ids firi he? GET /api/v1/models?type=image. Adeɛ a ɛda hɔ no,
@cf/black-forest-labs/flux-1-schnell, ɛtɔ kosoa mmerɛ 5 standard credits (50 sats) awieɛ
nhwɛsɛm biara. Ɛkanfoɔ biara de Pro credits di dwuma wɔ wɔn anigyeɛ ho nti, ne nnuane ne
nnyigyeɛ a ɛwɔ hɔ biara te sɛ, sɛnea ɛwɔ app no. n awɔnten nnyidie sɛn Ɔsikaɔ?
n nkan pii. Ebɔm bi a generator no nnye no, wɔtwitwa no na ɛnyɛ sɛ wɔgye so; standard generator no de prompt no nko ara yɛ adwuma.
| Akwantuo kwan | Twerɛ | Ɛsɛ sɛ wɔde di dwuma | Nkyerɛkyerɛmu |
|---|---|---|---|
model | ntɛntɛn | Aane | Generator id bi, te sɛ nano-banana. |
prompt | ntɛntɛn | Aane | Dɛn na yɛbɛhyɛ. Nkyerɛw a ɛdi kan mmienu ahennan (2,000) nkoaa na wɔde di dwuma. |
n | namba a ɛnyɛ nanteɛ namba | Daabi | 1 kɔ 4. Default no yɛ 1. Wotumi de kyerɛ sɛ num_images. |
size | ntɛntɛn | Daabi | Mfonini mmuae bi te sɛ "16:9", an OpenAI size te sɛ "1792x1024", a ɛbɛyɛ ne nkyɛn a ɛbɛtena ɛda 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 5:4 ne 4:5 mu no. "auto" Ɛde no ma generator no. |
aspect_ratio | ntɛntɛn | Daabi | Ɛyɛ saa ara no size, na ɔbɛn nka sɛ wɔahyɛ biara a. |
quality | ntɛntɛn | Daabi | Ɛyɛ generator-specific, te sɛ "low", "medium" annaa "high". |
negative_prompt | ntɛntɛn | Daabi | Dɛn na ɛsɛ sɛ yɛatwa nkyɛ? |
output_format | ntɛntɛn | Daabi | "png", "jpeg" annaa "webp". |
response_format | ntɛntɛn | Daabi | "url" (deɛ ɛda hɔ no) anase "b64_json". |
image_url | ntɛntɛn | Daabi | Mfoni bi a ɛbɛhyɛ aseɛ: an https:// link a ɛtɔ mfeɛ 4,096 kɛseɛ biara a ɛnni nnipa din anaa password wɔ mu, anaa a data:image/…;base64 URL (PNG, JPEG, WebP anaa GIF; ɛnyɛ SVG). Efri saa mmoa a wɔwɔ ne ho nko ara edit; ɛhia wɔ nea wɔwɔ requires_image_url. |
resolution yɛnfa so: ɔhyehyɛdeɛ biara yɛ ne nea ɛyɛ ne size ne ne nea ɛwɔ ne mu. Nea url,
awiehyɛ biara wɔ de kɔ Blossom host a obiara bɛtumi ahu no so na wone ne link (generator bi a ɛnyɛ pii na ɛma link wɔ n'ankasa, na ɛno nso wɔ de kɔ so). Obi a ɔwɔ link no biara bɛtumi akae na wɔ ntumi nnye no fi hɔ bio; hwɛ API no nea ɔtumi huɛne
b64_json wɔn dwuma mu no, ảnh no deɛ ɛsan ba wɔ mmuaeɛ no mu na ɛnyɛ sɛ wɔde di dwuma wɔ kɔmputa no so ara. Ảnh
a wɔahyɛɛ no sɛ a data: URL mu image_url ɛsɛƆ sɛ nea ɛyɛ anka
Siesie na wɔahyɛ no to Blossom mu tete na generator no ntena hwɛ no;
wɔde ɛsɛe no bio sɛ asɛm no nni mu.
Sɛ ɛda bi wɔ afe no mu a n Mfoni no nsi, wubɛnya nea ɛyɛe no nkoaa, na wɔbɛtwe wo sika nea ɛyɛe no nkoaa ho (ne nea ɔde mfoni no bɔɔ wo sika ansa na ɛante yie nso), na nymbot.failed ɛkyerɛ sɛ
bɛn na wɔannya. Sɛ nea ɛda mu nyinaa yɛ mfaso a, asɛm no bɛba nkyerɛmu no mu 502.
Aboa mu nkyerɛaseɛ
{
"created": 1790726400,
"model": "nano-banana",
"cost": 0.2126,
"data": [
{
"url": "https://blossom.example/5c0e4b7d3a91f2e8...c4.png",
"content_type": "image/png"
}
],
"nymbot": { "balance": "pro", "charged_credits": 1.817, "charged_sats": 181.7, "balance_credits": 410.608, "balance_sats": 41060.8 }
}
| Ɛdaeɛ | Ɛberɛ bɛn? |
|---|---|
400 | Nkabom bi nni hɔ; n awɔ mu 1 kɔsi 4 (invalid_value); size bɔne (invalid_size) anaa mfonini (invalid_image, invalid_image_url); model a bi wɔ hɔ nanso ɛnyɛ mmara mfoni (invalid_model); mfonini ma generator a ɔntumi asie (edit_unsupported); ɔhunu bi a ɛhia foto biara (image_required). |
402 | Akyiwadeɛ mu akontaabu no ntumi nnye awɔntenya biara a wɔbɛtumi asɛe no nkyerɛkyerɛmu nyinaa ho. |
404 | Ɛnyɛ model bi a ɛwɔ saa din no so (model_not_found). |
502 | Generator noa gyee (upstream_error). Hwee nni hɔ a wɔbɛkyɛ nni sɛ ɔyɛfo no de kɔdi ase no; ɛnna mberɛ no mu no ɛwɔ charged_sats. |
503 | Mfoni ntumiahyɛ mu saa yi (media_hosting_unavailable). b64_json ɛyɛ nneɛma biara ho ara nnɛ. |
cURL
curl https://nymbot.ai/api/v1/images/generations \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana",
"prompt": "A lighthouse at dusk, oil painting",
"size": "16:9"
}'
Python
import os
import requests
res = requests.post(
"https://nymbot.ai/api/v1/images/generations",
headers={"Authorization": "Bearer " + os.environ["NYMBOT_API_KEY"]},
json={"model": "nano-banana", "prompt": "A lighthouse at dusk, oil painting", "size": "16:9"},
)
res.raise_for_status()
print(res.json()["data"][0]["url"])
JavaScript
const res = await fetch("https://nymbot.ai/api/v1/images/generations", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.NYMBOT_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ model: "nano-banana", prompt: "A lighthouse at dusk, oil painting", size: "16:9" }),
});
const body = await res.json();
console.log(body.data[0].url);
Siesie mfoni
Ɛsesa ảnhan a wode hyɛɛ no, sɛnea woasɛe no. Wei ne OpenAI edit endpoint no, enti OpenAI
SDKs' images.edit ɛyɛ sɛnea ɛwɔ hɔ no ara. Pro generators nkoaa na wɔn wɔ edit wɔ model list no mu no, toɔ so fa.
POST https://nymbot.ai/api/v1/images/edits — API key tia, anaa Ɔsesɛe nnuane kɔmɔ biako koro kɔmɔ koro ho nna. Otumi no ne multipart/form-data, ɛsii 32 MB kɔ si.
| Akwantuo kwan | Twerɛ | Ɛsɛ sɛ wɔde di dwuma | Nkyerɛkyerɛmu |
|---|---|---|---|
image | nhoma | Aane | Mfonini a wɔbɛsiesie no: PNG, JPEG, WebP anaa GIF, kɔsi 20 MB. Wate nso sɛ image[]; nea ɛdi kan no wɔdeɛ. |
prompt | ntɛntɛn | Aane | Dɛn na ɛsɛ sɛ yɛsesa. |
model | ntɛntɛn | Aane | Generator a ɛwɔ edit. |
n | namba a ɛnyɛ nanteɛ namba | Daabi | 1 kɔ 4. |
sizeaspect_ratioqualitynegative_promptoutput_format | ntɛntɛn | Daabi | Ɛfa nkabom ho. |
response_format | ntɛntɛn | Daabi | "b64_json" (nea ɛda hɔ no) anaa "url". |
Woahyɛ mfoni a wode hyɛ mu no, yɛhwɛ sɛ ɛyɛ PNG, JPEG, WebP anaa GIF a ɛyɛ ne sɛnea ɛsɛ, na ɛyɛ ne nea ɛyɛ nokorɛ, na wɔahyɛ no Blossom host a obiara bɛtumi ahu no, ɛnam sɛ generator no de link na ɛfa nea ɛhia no fi. Te nea ɛteɛ sɛ obiara bɛtumi ahu no. Sɛ edwuma no annyɛ na wɔnnyɛ wo denkyɛm a, wɔbɛtwa mfoni no a wɔahyɛ no adi. Nea ɛbɛba no yɛ te sɛ nea ɛba berɛ a woyɛ adwuma no. Denkyɛm no yɛ generator no denkyɛm, na ɛnam sɛ generator bi de mfoni a wode hyɛ mu no nso hyɛ ne denkyɛm mu.
Aboa mu nkyerɛaseɛ
{
"created": 1790726460,
"model": "nano-banana",
"cost": 0.2126,
"data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }],
"nymbot": { "balance": "pro", "charged_credits": 1.817, "charged_sats": 181.7, "balance_credits": 408.791, "balance_sats": 40879.1 }
}
| Ɛdaeɛ | Ɛberɛ bɛn? |
|---|---|
400 | Mfoni anaa asɛm biara nni hɔ, ɛda mfonini a ɛnyɛ mfonini bi ho (invalid_image), anaa generator a ɛntumi nkyerɛw kyerɛ aseɛ (edit_unsupported). |
413 | Mfoni no dɔɔso twa 20 MB (file_too_large), anaa mpaebɔ no nyinaa nnye 32 MB akyiri. |
503 | Mfoni no ntumi nnyɛ hɔ mpo (media_hosting_unavailable). |
cURL
curl https://nymbot.ai/api/v1/images/edits \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-F model=nano-banana \
-F [email protected] \
-F prompt="Make it a snowy evening"
Python
import base64, os
from openai import OpenAI
client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])
with open("photo.png", "rb") as f:
result = client.images.edit(model="nano-banana", image=f, prompt="Make it a snowy evening")
with open("edited.png", "wb") as out:
out.write(base64.b64decode(result.data[0].b64_json))
JavaScript
import fs from "node:fs";
import { writeFile } from "node:fs/promises";
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });
const result = await client.images.edit({
model: "nano-banana",
image: fs.createReadStream("photo.png"),
prompt: "Make it a snowy evening",
});
await writeFile("edited.png", Buffer.from(result.data[0].b64_json, "base64"));
Video
Video biara nya nnɔkan, enti ɛyɛ adwuma wɔ m'akɔm mmuaeɛ mu. Wode to no, na woanya id kɛtɛw ara, na wohyɛ aseɛ sɛ wubisa fa id no ho kɔsi sɛ ɛyɛ adwuma. Video generator biara di Pro balance no no.
POST https://nymbot.ai/api/v1/videos — API key tia, anaa Ɔsesɛe nnuane kɔmɔ biako koro kɔmɔ koro ho nna. Sɛ ɛde nneɛma ba Ɛnyɛ 202.
| Akwantuo kwan | Twerɛ | Ɛsɛ sɛ wɔde di dwuma | Nkyerɛkyerɛmu |
|---|---|---|---|
model | ntɛntɛn | Aane | Video nwonkoɔfoɔ id firi GET /api/v1/models?type=video, te sɛ veo. |
prompt | ntɛntɛn | Aane | Dɛn na ɛsɛ sɛ ɛsi. |
duration | Nɔma anaa nhoma | Daabi | Sekonde mmerɛ, ɛnyɛ 0 na ɛda 60 so. Wɔde si dwuma wɔ generator a ɛma wo fa mmerɛ no ato ano nkoaa; afoforɔ no de wɔn mmerɛ a ɛda so no na wɔde. seconds wɔ mmuaeɛ no mu ne otuɔ no wɔto so. |
aspect_ratio | ntɛntɛn | Daabi | Te sɛ "16:9" annaa "9:16"; kɛsize bi te sɛ "1280x720" ɛbɛyɛ ne nkyɛ kɛseɛ. |
resolutionquality | ntɛntɛn | Daabi | Generator no mu bi ne resolutions model list no mu, te sɛ "720p" annaa "1080p"Ɛde ɔdwuma no din. Nea ɛnyɛ saa no, wɔato nnyina kyerɛ sɛ wɔansi nnyina no. unsupported_resolution. |
image_url | ntɛntɛn | Daabi | Mfoni bi a ɛbɛhyɛ aseɛ: an https:// link anaa a data:image/… URL, a wɔde hyɛ Blossom host a ɛyɛ mpɔtam mu ansa na. Ɛhia wɔ generator a ɛwɔ... requires_image_url. |
Ɔdwuma no dwuma no din nni hɔ koraa sɛ wode ɛyɛ no, firi generator no, resolution no, ne length no mu, enti yɛfa wo Pro balance no mu kɔ mmerɛ no nyinaa sɛ provider no ahyɛ adwuma no no, na ɛhɔ nso wɔ sɛ
cost, estimated_cost ne nymbot. Sɛ ɔdomfo no kwa nneɛma no, bɔne biara nni hɔ. Sɛ render no gyina hɔ anadwo anaa ɛda bi a, anaa sɛ clip no a wɔawɔ no no ntumi nsi hɔ
na ɔdomfo no nnyɛ akwantu biara ho nkyerɛkyerɛmu, akyerɛkyerɛmu no bɛsan ma wo nea wo de hyɛɛ mu, ɛnyɛ nneɛma pii, na ɛyɛ no nea ɛyɛ fɛ dedaw. Render a ɛrekɔ so ansa na awieɛ ankan mmienu anɔpa no, wɔagya no, na wɔnyaa nea wɔde hyɛɛ mu no, ɛfiri sɛ ɔdomfo no de akwantu no bɔ akwantu mmienu ansa na ɔde hyɛɛ mu. Sɛ wɔde sika/credits san ma wo a, ɛma wo credits no san kɔ wo nsa, nanso ɛnyɛ ɛkyerɛkyerɛmu no ho nkyerɛkyerɛmu no.
Akyerɛkyerɛmu (202)
{
"id": "vid_3e9a51c07b2f4d86e0a1c4f2",
"object": "video",
"model": "veo",
"status": "in_progress",
"created": 1790726400,
"seconds": 8,
"resolution": "1080p",
"estimated_cost": 3.18,
"expires_at": 1790812800,
"cost": 3.18,
"nymbot": { "balance": "pro", "charged_credits": 31.8, "charged_sats": 3180, "balance_credits": 378.808, "balance_sats": 37880.8 }
}
status ɛdom sɛ in_progress, anaa completed video noɔ
a ɛwɔ mu no data ɛberɛ a generator no deɛ ɛbaa no ntɛmɛɛ sɛnea ɛteɛ no.
Merekasɛe video bi ho
GET https://nymbot.ai/api/v1/videos/{id} — ɛhia kɔteɛ a ɛtɔ nym a ɔde hyɛɛ no no so. Kɔteɛ a ɛaka ne kwan no nso bɛtumi asɛe.
Ɛbua 202 sɛ wɔreyɛ video no na 200 sɛ ɛkɔɔ anaa ɛyɛɛ nkwagye a. Bɛtwe ase nka nkyerɛkyerɛfo no nka sɛ mma 5 kɔsi 10. Ɛsesaeɛ biara hyɛ nkyerɛkyerɛfo no asɛm nka kɔ mpɛn mmerɛw uma, na ɛhyɛ aseɛ nso nkyerɛnsɛm no nso nkyerɛnsɛm kɔmpɔn; ɛnyɛ ɛde video no hwɛ. Adwuma bi wɔ hɔ a wɔde hyɛ aseɛ annye mmerɛw mmienu (24 hours) akyi.
GET /api/v1/videos kyerɛ key adwuma a ɛwɔ ne n'anim mmaromen a ɛdi kan no dwuma 50 a ɛyɛ sɛ
{"object": "list", "data": […]}.
Mmuaeɛ (200)
{
"id": "vid_3e9a51c07b2f4d86e0a1c4f2",
"object": "video",
"model": "veo",
"status": "completed",
"created": 1790726400,
"seconds": 8,
"resolution": "1080p",
"estimated_cost": 3.18,
"expires_at": 1790812800,
"completed_at": 1790726590,
"data": { "url": "https://blossom.example/9b41d0c2e7a3f658...1e.mp4", "content_type": "video/mp4" },
"cost": 3.18,
"nymbot": { "balance": "pro", "charged_credits": 31.8, "charged_sats": 3180 }
}
status ɛyɛ in_progress, completed annaa failed. A
adwuma a ɛyɛ mpaebɔ bi kɔ fã kɔ de kɔ kyerɛ nneɛma error ({"code": "generation_failed", "message": …});
sɛ wɔde sika no hyɛɛ wo nsa a, cost yɛ 0 na nymbot bɔne wɔn mu
refunded_credits ne refunded_satsVideo a ɛhyɛ mu no wɔ Blossom host a obiara bɛtumi ahu no so, sɛnea wɔyɛɛ mfonini a wɔayi afiri computer so no.
| Ɛdaeɛ | Ɛberɛ bɛn? |
|---|---|
400 | Nkyerɛkyerɛmu biara nni; mmeae a ɛda 0 kɔsi 60 ntam (invalid_value); resolution a generator no fa (unsupported_resolution); mfonini nni hɔ ma generator a ɛhia bi (image_required); mmodel a ɛnyɛ video generator (invalid_model). |
402 | Pro balance no ntumi nkyekyere video no so. |
404 | Biara nni saa generator no (model_not_found), anaa adwuma biara nni hɔ a ɛfa saa id yi ho ma wo nym, anaa ɛrefiri nnɔkra mmienu (24 hours) a ɛdi kan (video_not_found). |
429 | Wo nym mu hɔn video du (10) a ɛrehyɛ aseɛ arai (video_jobs_limit). Sɔ hɔn hwɛ na fa deɛ ɛnyɛ biara kɔma wɔn sɛ obi bi awie. |
502 | Adaka no nnaeɛ adwuma no. Ɛnyɛ obiara na wɔbɛtɔ den, sɛ provider no nnyaeɛ biara nni hɔ a. |
503 | Video nnyɛ mma anaa yɛn ani mfa wɔ hɔ mpɛn yi (media_hosting_unavailable, service_unavailable). |
cURL
curl https://nymbot.ai/api/v1/videos \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "veo", "prompt": "Waves rolling onto a beach at sunrise", "duration": 8, "aspect_ratio": "16:9"}'
curl https://nymbot.ai/api/v1/videos/vid_3e9a51c07b2f4d86 \
-H "Authorization: Bearer $NYMBOT_API_KEY"
Python
import os, time
import requests
headers = {"Authorization": "Bearer " + os.environ["NYMBOT_API_KEY"]}
job = requests.post(
"https://nymbot.ai/api/v1/videos",
headers=headers,
json={"model": "veo", "prompt": "Waves rolling onto a beach at sunrise", "duration": 8, "aspect_ratio": "16:9"},
).json()
while True:
time.sleep(8)
status = requests.get("https://nymbot.ai/api/v1/videos/" + job["id"], headers=headers).json()
if status["status"] in ("completed", "failed"):
break
print(status["data"]["url"] if status["status"] == "completed" else status["error"])
JavaScript
const headers = {
"Authorization": "Bearer " + process.env.NYMBOT_API_KEY,
"Content-Type": "application/json",
};
const job = await (await fetch("https://nymbot.ai/api/v1/videos", {
method: "POST",
headers,
body: JSON.stringify({ model: "veo", prompt: "Waves rolling onto a beach at sunrise", duration: 8, aspect_ratio: "16:9" }),
})).json();
let status;
do {
await new Promise((r) => setTimeout(r, 8000));
status = await (await fetch("https://nymbot.ai/api/v1/videos/" + job.id, { headers })).json();
} while (status.status !== "completed" && status.status !== "failed");
console.log(status.status === "completed" ? status.data.url : status.error);
Asɛm a wɔatwerɛ ma nne
Kasa nwoma no ho nkyerɛaseɛ na ɛde audio file no nko ara ma wo, ɛnyɛ link. Ɛyɛ OpenAI speech endpoint no,
anaasɛ audio.speech.create OpenAI SDKs mu yɛ.
POST https://nymbot.ai/api/v1/audio/speech — API key tia, anaa Ɔsesɛe nnuane kɔmɔ biako koro kɔmɔ koro ho nna.
| Akwantuo kwan | Twerɛ | Ɛsɛ sɛ wɔde di dwuma | Nkyerɛkyerɛmu |
|---|---|---|---|
model | ntɛntɛn | Daabi | Kasa kyerɛbea firi audio model nhoma no nkyerɛkyerɛmu. Anɔpaduonyam: ɔkwan a ɛdi kan no, @cf/myshell-ai/melotts. aura-2 Deepgram Aura 2 anaa? |
input | ntɛntɛn | Aane | Nkyerɛwdeɛ a wɔbɛkenkan no: kɔsi nkyerɛwdeɛ 800 ma standard voice no, 2,000 ma Aura 2. |
voice | ntɛntɛn | Daabi | Nneɛma a ne nne sɛ nea afofor nne bi firi nneɛma a nneɛma nnye nnye dwom no list no: Aura speaker a ɛte sɛ luna (anɔpa aura-2-luna-en), anaa MeloTTS kasa (en, es, fr, zh). OpenAI nne din te sɛ alloy wɔne wɔn a wɔhyɛɛ wɔn ase na ɛde model no anigye ne ne nne a ɛwɔ hɔ no. |
language | ntɛntɛn | Daabi | Kasa kɔdu te sɛ esƐnyɛ ne nne so, ɛboa no ma ɔnya bi kɔ saa kasa no mu. Nne a ɛka kasa foforɔ no san ba. 422 voice_language_mismatch, ne kasa a model no nni nneɛma bi ho nnyigyeɛ bi ho 422 unsupported_language. |
response_format | ntɛntɛn | Daabi | Anomɔdee nne no san ba mp3 akɔkɔɔ. Aura 2 san wɔn mp3 (nea ɛda hɔ no), opus, aac, flac, wav annaa pcm. |
speed | nɔba | Daabi | Yɛahyɛɛ no ase na yɛatow no nti. |
Voice a ɛhoɔfam no tɔ sɛ standard credits 3 (30 sats) kɔmɔ biara, sɛnea ɛwɔ app no mu no. Aura 2
yɛ Pro, na ɛtɔ sɛnea ɛwɔ nhoma a wosɛe no mu nkyerɛwee no mu. Ne mmuaeɛ no ne audio no, na ɛwɔ ɛtɔ mma a ɛfa ho 🏾
Content-Type; ɔhyɛ no wɔ ... X-Nymbot-Cost-Sats header. Sɛ
kasafɔ no ntumi nnye a, obiara nnye sika.
Aboa mu nkyerɛaseɛ
HTTP/1.1 200 OK
Content-Type: audio/mpeg
X-Nymbot-Cost-Sats: 4.2
X-Nymbot-Balance-Sats: 41055.6
(audio bytes)
| Ɛdaeɛ | Ɛberɛ bɛn? |
|---|---|
400 | Nsuo biara nni; nsuo ayɛ aduru a ɛdidi mɔdemu no anjam 🪫input_too_long); formæt bi a model no ntumi nnyɛ (unsupported_response_format); ɔnoɔm nne a yɛnim (invalid_voice); ɔmodel a ɛnyɛ kasa model (invalid_model). |
422 | Aŋkoasɛm no nka kasa a wɔahyɛɛ no, anaa model no nni nkoasɛm biara ma saa kasa no. |
502 | Kasa model no ayɛ ɔhaw. Ɛnyɛ hwee biara na wɔatua. |
cURL
curl https://nymbot.ai/api/v1/audio/speech \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "aura-2", "voice": "luna", "input": "Your invoice has been paid."}' \
--output speech.mp3
Python
import os
from openai import OpenAI
client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])
audio = client.audio.speech.create(
model="aura-2",
voice="luna",
input="Your invoice has been paid.",
)
audio.write_to_file("speech.mp3")
JavaScript
import { writeFile } from "node:fs/promises";
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });
const audio = await client.audio.speech.create({
model: "aura-2",
voice: "luna",
input: "Your invoice has been paid.",
});
await writeFile("speech.mp3", Buffer.from(await audio.arrayBuffer()));
Awiee mmoawa ne nneɛma
Adeyɛ mmienu a ɛwɔ kɔm mu ma wɔahyia speech model ne nne, anaa transcription model. Aura 2 Akan kyerɛwfoɔ adan mmiensa ne MeloTTS kasa nkwa mmienu.
GET https://nymbot.ai/api/v1/audio/models — kwan biara nni hɔ a ɛhia.
GET https://nymbot.ai/api/v1/audio/voices?language=en — kwan biara nni hɔ a ɛhia.
| Akwantuo kwan | Twerɛ | Ɛsɛ sɛ wɔde di dwuma | Nkyerɛkyerɛmu |
|---|---|---|---|
language | string (asɛm asɛ:") | Daabi | Ɛda nneɛma yi nti nneɛma yi nkoaa nneɛma na ɛwɔ saa kasa yi mu. |
model | string (asɛm asɛ:") | Daabi | Ɛnyinaa nneɛma pɛ nneɛma nkoaa ma saa model yi. |
Mmuaeɛ (nneɛ)
{
"object": "list",
"data": [
{ "id": "luna", "name": "Luna", "provider": "deepgram", "model_id": "aura-2", "models": ["aura-2"], "language": "en", "description": "Aura 2 English voice", "gender": "female", "preview_url": null },
{ "id": "en", "name": "MeloTTS English", "provider": "myshell", "model_id": "@cf/myshell-ai/melotts", "models": ["@cf/myshell-ai/melotts", "melotts"], "language": "en", "description": "English (MeloTTS)", "gender": null, "preview_url": null }
]
}
Mmoa mmeaeɛ no nnuaeɛ no nnuaeɛ mu nsɛmm/\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s {"object": "list", "data": {"tts": […], "stt": […]}}Kasa mmoa biara ma ne nkyɛm ne ne boɔ, max_input_chars,
response_formats, languages ne default_voice; nkyerɛkyerɛmu model no ma ne din anom nnyinasoɔ no, max_file_bytes, max_seconds,
nhoma nkyerɛkyerɛmu ne ahoɔden nkyerɛkyerɛmu wɔ minit biako ho.
cURL
curl https://nymbot.ai/api/v1/audio/models
curl "https://nymbot.ai/api/v1/audio/voices?language=en"
Python
import requests
print(requests.get("https://nymbot.ai/api/v1/audio/models").json())
for voice in requests.get("https://nymbot.ai/api/v1/audio/voices", params={"language": "en"}).json()["data"]:
print(voice["id"], voice["model_id"])
JavaScript
console.log(await (await fetch("https://nymbot.ai/api/v1/audio/models")).json());
const voices = await (await fetch("https://nymbot.ai/api/v1/audio/voices?language=en")).json();
for (const v of voices.data) console.log(v.id, v.model_id);
Kasa kɔ nwoma mu
Whisper de ahondwee sesa nkyerɛwee so. Eyi ne OpenAI transcription endpoint no, enti...
audio.transcriptions.create ɛyɛ adwuma.
POST https://nymbot.ai/api/v1/audio/transcriptions — API key tia, anaa Ɔsesɛe nnuane kɔmɔ biako koro kɔmɔ koro ho nna. Otumi no ne multipart/form-data.
| Akwantuo kwan | Twerɛ | Ɛsɛ sɛ wɔde di dwuma | Nkyerɛkyerɛmu |
|---|---|---|---|
file | nhoma | Aane | A nnyinaso no, fi 256 bytes firi kɔ 25 MB ne mfeɛ mmiɛnsa kɔ sukuu mmiɛnsa: WAV, WebM, MP4 ɔ M4A, Ogg ɔ Opus, MP3 ne sae akyerɛkyerɛ deɛ Whisper kenkan. MP3 ne sae akyerɛkyerɛ a wɔntumi nkenkan wɔ tete no, wɔahyɛ wɔn nyinaa kɔ 1.8 MB. |
model | ntɛntɛn | Daabi | Akyiwadeɛ whisper, aɛyɛ Whisper Large v3 Turbo. whisper-1, whisper-large-v3-turbo ne @cf/openai/whisper-large-v3-turbo ɛyɛ pɛ sɛ ɛyɛ deɛ ɛyɛ pɛ ara. |
language | ntɛntɛn | Daabi | Kasa no, te sɛ enƐyɛ possible sɛ wɔhunu sɛ wɔanyɛ no a. |
prompt | ntɛntɛn | Daabi | Nsɛmfua anaa nkyerɛw a wobɛtumi ahu, te sɛ dinom. Nkyerɛwdeɛ a ɛdi kan ɔhaã nkoaa na wɔfa so. |
response_format | ntɛntɛn | Daabi | json (nea ɛda hɔ no), text, srt, vtt annaa verbose_json. |
Ma WAV, WebM, MP4 ne Ogg files no, wɔkyerɛ nkyɛn (length) no fi file no mu ansa na biribiara mmpue, enti wɔgyina rekɔdi a ɛwɔ miniti 30 ahyɛ so (ne mmasua mmiɛnsa a ɛwɔ hɔ) ansa na wɔanya no (ansa na wɔannua no). WAV file bi nkyɛn firi ne sample rate, channels ne sample size mu. Saa mfeɛ (formats) afoforo a ɛte sɛ MP3 no nkyɛn, wɔntumi nkyerɛ no ansa na biribiara mmpue, enti wɔkyere wɔn wɔ size mu: wɔ bitrate a ɛwɔ aseɛ paa a Nymbot hyɛ aseɛ, 8 kbps, miniti 30 yɛ 1.8 MB, na file a ɛwɔ saa format no mu sɛ ɛyɛ kɛseɛ no, wɔgyina no wɔ 413
audio_too_long adeɛ biara anante ase ansa. Twere nnyigyeɛ a ɛyɛ tenten no sɛ WAV, WebM, MP4 anaa Ogg.
Sɛ Whisper kyerɛ sɛ nnyigyeɛ no kɔ so mfeɛ 30 a, wɔa gyee kyerɛ sɛ
413 audio_too_long, na Whisper yɛɛ adwuma a, miniti nwɔtwe mmiɛnsa na
wɔtɔ bɔ.
Wo bɔ sɛ wɛn nneɛma a ɛwɔ audio no mu ahoɔden no ho, na ɛbɛyɛ sɛ ɛyɛ mmienu a ɛdi so: ɛda nea ɛwɔ file no mu ahoɔden kɛseɛ no, nea Whisper kyerɛ no, ne nea file no size no ma, wɔ Whisper nnuane mmienu biara ho boɔ no so, ne nnuane a ɛwɔ mmuaeɛ ne margin no mu, na ɛnsɛ sɛ ɛyɛ credit 0.05 koraa wɔ request biara ho. Yɛbɔ nea ɛwɔ balance no mu sɛ ɛbɛtumi ahyɛ mu, na sɛ ɛnyɛ saa a yɛbɔ no fi Pro mu; a 402 εkyerɛ nea ɛdi awerɛhoɔ biara nti a ɛhia. Wɔ app no mu no, sɛnea ɛbɛyɛ a wode nne mmesaeɛ kyerɛw no bɛtena ase; na wɔ API no mu no, wɔkyɛ no da biara. Sɛ Whisper yɛ fɔ a, wɔnni ade bi a wɔbɛkyɛ no.
Aboa mu nkyerɛaseɛ
{
"text": "Your invoice has been paid.",
"usage": { "type": "duration", "seconds": 3 },
"nymbot": { "balance": "standard", "charged_credits": 0.05, "charged_sats": 0.5, "balance_credits": 120.35, "balance_sats": 1203.5 }
}
text ɛma asɛm a ɛnoɔyɛ srt ne vtt fa asɛm a wɔnkyerɛw kyerɛw no mmra, na
verbose_json de kasa no, berɛ a ɛkyɛ no, ne nkyekyɛmu a ɛwɔ berɛ mu hyɛ mu. Ne nneɛma mmiɛnsa a ɛnyɛ
JSON no ho, nnyigyeɛ no wɔ header no mu.
| Ɛdaeɛ | Ɛberɛ bɛn? |
|---|---|
400 | File bi nni hɔ, file a nnyigyeɛ a yɛbɛtumi atie biara nni mu (invalid_audio), anɔni nkyerɛkyerɛmu a yɛnni bi, anaa model a ɛnyɛ transcription model (invalid_model). |
402 | Ɛne biara nni hɔ a ɛbɛtumi ahyɛ biara. |
413 | File noɔ yɛ MB 25 kɔ kɔmɔ (file_too_large) anaa asɛm a wɔahyɛ aseɛ no tenten ne minuti ne mmiɛnsa (30) a ɛregye so, anaa, wɔ format bi mu a wɔnntumi nkyerɛ ne tenten ansa na wɔahyɛ aseɛ, 1.8 MB a ɛregye so (audio_too_long). |
502 | Whisper ntumi anhwɛ nneɛma a ɛwɔ nneɛma no mu no. Adeɛ biara nni mu a yɛbɛsi wo so. |
cURL
curl https://nymbot.ai/api/v1/audio/transcriptions \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-F [email protected] \
-F model=whisper \
-F response_format=json
Python
import os
from openai import OpenAI
client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])
with open("memo.m4a", "rb") as f:
transcript = client.audio.transcriptions.create(model="whisper", file=f)
print(transcript.text)
JavaScript
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });
const transcript = await client.audio.transcriptions.create({
model: "whisper",
file: fs.createReadStream("memo.m4a"),
});
console.log(transcript.text);
Kasa kɔ Twi mu de kyerɛ English
POST https://nymbot.ai/api/v1/audio/translations — API key tia, anaa Ɔsesɛe nnuane kɔmɔ biako koro kɔmɔ koro ho nna. Otumi no ne multipart/form-data.
Transcription no te sɛ, ne nkyerɛkyerɛmu a ɛyɛ pɛ no mu nanso language, mpanim mpono ne
ɔsɔɔdeɛ, nanso adwuma no tɔ mpanim mpono no mu wɔ Akan kasa biara a wɔkaa no. OpenAI SDKs no
frɛ no sɛ audio.translations.create.
cURL
curl https://nymbot.ai/api/v1/audio/translations \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-F [email protected] \
-F model=whisper
Python
import os
from openai import OpenAI
client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])
with open("nota.m4a", "rb") as f:
translation = client.audio.translations.create(model="whisper", file=f)
print(translation.text)
JavaScript
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });
const translation = await client.audio.translations.create({
model: "whisper",
file: fs.createReadStream("nota.m4a"),
});
console.log(translation.text);
Embeddings
Ɛma asɛm (text) nyinaa wɔ vector ma hwɛhwɛ, clustering ne deduplication. Model noɔrerɛ no bɔ Cloudflare so na ɛdi w'asɛdeɛ (balance) a ɛwɔ hɔ no so.
POST https://nymbot.ai/api/v1/embeddings — API key tia, anaa Ɔsesɛe nnuane kɔmɔ biako koro kɔmɔ koro ho nna.
| Akwantuo kwan | Twerɛ | Ɛsɛ sɛ wɔde di dwuma | Nkyerɛkyerɛmu |
|---|---|---|---|
model | ntɛntɛn | Aane | Embedding model bi firi GET /api/v1/models?type=embedding. |
input | string anaa array a ɛwɔ string | Aane | Ate a wopɛ sɛ wode hyɛ mu no, ɛtɔ mfeɛ 100 a ɛnyɛ mmuae biara. Token array no nnye yɛ (token_input_unsupported). Adeɛ biara a ɛba mu no ɛsɛ sɛ ɛfitɔ model no context_length, wɔnea kɔ mɔ bɔ ne sɛ bɔ ne nkyɛn nka mɔ nnan. |
encoding_format | ntɛntɛn | Daabi | float (deɛ ɛda hɔ no) anase base64 (little-endian 32-bit floats). |
dimensions | namba a ɛnyɛ nanteɛ namba | Daabi | Model no dɔɔsoɔ ankasa, anaa ɛyɛ ma model bi a ɔwɔ supported_dimensions biako wɔ hɔn mu; afei wɔyɛ vector no kɔtɔ na wɔyɛ no sɛnea ɛsɛ sɛ ɛwɔ hɔ. Nea ɛda saa so biara wɔapa. |
| Mfomsuo | Nkabommuo | Asɛm a ɛhyɛ asɛm no mu |
|---|---|---|
@cf/baai/bge-m3 | 1024, kasa pii | 8,192 tokens |
@cf/qwen/qwen3-embedding-0.6b | 1024, kasa pii | 8,192 tokens |
@cf/baai/bge-large-en-v1.5 | 1024, Ingliz | 512 nkyerɛwee |
@cf/baai/bge-base-en-v1.5 | 768, Akan | 512 nkyerɛwee |
@cf/baai/bge-small-en-v1.5 | 384, Akan | 512 nkyerɛwee |
Mfitiaseɛ mbuo mfonini nkyerɛkyerɛmu no ne nokwarefoɔ nkyerɛkyerɛmu a ɛkyerɛ sɛ mfonini bɛn na ɛwɔ na wɔn adidiɔ nso; Google's EmbeddingGemma, a ɛwɔ vectors a ɛyɛ mmerɛwɛ wɔ nnɛmmuɔ so, ɛhɔ nso wɔ hɔ sɛ katalog no wɔ adidiɔ ho nkyerɛkyerɛmu a ɛwɔ ho. Embeddings yɛ adidiɔ wɔ input token adwuma so, na 0.05-credit minimum no wɔ nnɛmmuɔ biara so, ɛnyɛ input biara so, enti sɛ wode mmema pii yɛ nnɛmmuɔ koro mu no, ɛyɛ adidiɔ kɛseɛ sene sɛ wode wɔn baako baako.
Aboa mu nkyerɛaseɛ
{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0213, -0.0487, 0.0112] }
],
"model": "@cf/baai/bge-m3",
"usage": { "prompt_tokens": 9, "total_tokens": 9 },
"nymbot": { "balance": "standard", "charged_credits": 0.05, "charged_sats": 0.5, "balance_credits": 1204.35, "balance_sats": 12043.5 }
}
| Ɛdaeɛ | Ɛberɛ bɛn? |
|---|---|
400 | Nsuo biara anaa biara a ɛmu nni hɔ; token arrays (token_input_unsupported); ɛda ɛkan 100 nsuan (too_many_inputs); mfitiaseɛ a ɛyɛ kɛseɛ sene model no kwan (input_too_long); size a model no tumi bɛtumi ama (unsupported_dimensions). |
402 | Standard balance no yɛ ketewa paa. Embeddings mma Pro balance no nna da. |
404 | Ɛnyɛ saa din no nkyerɛkyerɛmu model bi. |
502 | Model noa nantee. Adeɛ biara nni hɔ a wɔahyɛ so. |
cURL
curl https://nymbot.ai/api/v1/embeddings \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "@cf/baai/bge-m3", "input": ["Lightning invoices expire.", "Invoices on Lightning have a time limit."]}'
Python
import os
from openai import OpenAI
client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])
result = client.embeddings.create(
model="@cf/baai/bge-m3",
input=["Lightning invoices expire.", "Invoices on Lightning have a time limit."],
)
print(len(result.data), len(result.data[0].embedding))
JavaScript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });
const result = await client.embeddings.create({
model: "@cf/baai/bge-m3",
input: ["Lightning invoices expire.", "Invoices on Lightning have a time limit."],
});
console.log(result.data.length, result.data[0].embedding.length);