Hla mus rau cov ntsiab lus
Rov mus rau Nymbot

Kev paub hauv paus Cov neeg tsim software

Duab, suab thiab embeddings

Cov tshuab tsim los ntawm lub app, thiab cov tshuab tsim rau kev nrhiav: duab, video, lus hais, kev sau ntawv thiab embeddings, txhua yam yuav raug them nyiaj raws li kev siv los ntawm koj tus nqi.

Tsim cov duab

Tsim ib mus rau peb daim duab los ntawm ib lo lus qhia thiab xa mus thaum lawv npaj txhij. Nws yog tib lub tshuab tsim duab uas yog ?image hau hauv lub app.

POST https://nymbot.ai/api/v1/images/generations — yuav tsum muaj ib daim API key, los yog ib qho kev them nqi Lightning rau txhua qhov kev thov.

Ids tuaj ntawm GET /api/v1/models?type=image. Lub tshuab tsim hluav taws xob uas tsim nyog, @cf/black-forest-labs/flux-1-schnell, nqi yog 5 standard credits (50 sats) rau ib daim duab. Txhua qhov tsim tshiab (generator) tsis zoo, lawv siv Pro credits raws li lawv tus nqi xwb, nrog rau cov nqi tswj thiab margin li qub, zoo li hauv lub app. n Duab nqi n thawj ntau zaug. Ib lub nplooj (field) uas ib lub generator tsis muaj yuav raug tshem tawm mus rau ntawm kev tsis lees yuav; lub standard generator siv cov lus qhia (prompt) xwb.

NtawvSauIb yam xav tauDaim Ntawv Qhia
modelximYog lawmIb lub tshuab tsim hluav taws xob, xws li nano-banana.
promptximYog lawmYuav tsum kos dab tsi. Tsuas yog siv 2,000 tus npe thawj luv xwb.
ntus lej txhua ntuTsis yog1 mus rau 4. Lub tseg tsis hloov yog 1. Ntawm tau txais los yog num_images.
sizeximTsis yogIb qho ratio xws li "16:9", los yog qhov loj ntawm OpenAI xws li "1792x1024", uas yuav dhau los ua qhov ze tshaj plaws ntawm 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 5:4 thiab 4:5. "auto" cia rau tus tsim.
aspect_ratioximTsis yogIb yam nkaus li size, thiab yeej yog yog tias ob leeg raug xa mus.
qualityximTsis yogKhaws tau rau tus tsim tshwj xeeb, xws li "low", "medium" los yog "high".
negative_promptximTsis yogYuav tsum tso twg tseg.
output_formatximTsis yog"png", "jpeg" los yog "webp".
response_formatximTsis yog"url" (tus tswv yim ntawm hauv) lossis "b64_json".
image_urlximTsis yogIb daim duab pib thaum: ib https:// lub link uas tsis tshaj 4,096 tus nuj qis uas tsis muaj neeg siv npe lossis password nyob rau hauv, lossis ib data:image/…;base64 URL (PNG, JPEG, WebP loss GIF; tsis yog SVG). Tsuas yog rau cov tsim nrog uas muaj edit; yuav tsum tau muaj rau cov neeg uas muaj requires_image_url.

resolution tsis yog siv: txhua lub generator tsim nws tus kheej qib loj. Nrog url, daiv txhua daim duab yog raug ntim rau Blossom host uas pej xeem pom thiab koj yuav tau nws lub link (yog tsuas muaj qee yam generator xwb uas muab nws lub link tseg, uas yuav raug xa mus ntxiv). Tus neeg twg muaj lub link los kuj tuaj qhib tau thiab nws yuav tsis tau raug tshem tawm mus dua; saib API ntawd tuaj yeem pom dab tsi. Nrog b64_json lub duab rov qab los hauv cov lus teb thiab tsis tau raug upload li. Ib daim duab xa ua ib lo lus data: URL nyob rau hauv image_url yog raug tshawb xyuas zoo nkaus li ib Kho thiab raug muab tso rau Blossom ua ntej kom lub generator tuaj nqa tau nws; nws yuav raug muab tshem tawm dua yog tias qhov kev thov tsis tau them nqi.

Yog tias qee yam ntawm n cov duab tsis ua tau, koj yuav tau cov uas ua tau, koj yuav raug them nqi rau cov ntawd xwb (thiab lwm yam uas tus neeg muab xov tooj them txawm tias tsis ua tau), thiab nymbot.failed hais tias tsim ntau yog leej twg tsis muaj. Yog txhua yam tsis ua tau, qhov kev thov yuav rov qab los 502.

Teb lus

{
  "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 }
}
Qhov xwm txheejThaum twg
400Tsis muaj lus qhia; n sab nraud 1 mus rau 4 (invalid_value); ukuran tsis zoo (invalid_size) lossis duab (invalid_image, invalid_image_url); ib q hom tshuab uas muaj tiag tab sis tsis yog tshuab tsim duab (invalid_model); ib daim duab rau ib lub tshuab tsim uas tsis tuaj yeem hloov kho (edit_unsupported); tsis muaj daim duab rau ib qho uas xav tau nws (image_required).
402Kev them tswv yim tsis tuaj txaus rau txhua daim duab uas tau thov.
404Tsis muaj qauv (model) uas muaj lub npe ntawd (model_not_found).
502Lub tshuab tsim hluav taws xob tsis ua hauj lwm (upstream_error). Tsis muaj dab tsi raug them nqi med rau tsis yog tus neeg muab kev pab tau them rau qhov kev sim ntawd; ces qhov yuam kev ntawd muaj charged_sats.
503Zaum no tsis tau khaws cov duab tseg (media_hosting_unavailable). b64_json tseem ua tau os.

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

Kho cov duab

Hloov ib daim duab uas koj tso tuaj, raws li cov lus qhia. Qhov no yog OpenAI cov edit endpoint, yog li OpenAI SDKs' images.edit ua haujlwm li nws nyob. Tsuas yog cov generators Pro nrog edit hauv cov model ntau lub npe txais nws.

POST https://nymbot.ai/api/v1/images/edits — yuav tsum muaj ib daim API key, los yog ib qho kev them nqi Lightning rau txhua qhov kev thovLub cev yog multipart/form-data, mus txog 32 MB.

NtawvSauIb yam xav tauDaim Ntawv Qhia
imagentau ntawvYog lawmLub duab yuav tsum hloov: PNG, JPEG, WebP lossis GIF, txog 20 MB. Ntawm no kuj lees txais kuj tias yog image[]; thawj daim yog siv.
promptximYog lawmYuav hloov dab tsi.
modelximYog lawmIb lub tshuab tsim hluav taws xob nrog edit.
ntus lej txhua ntuTsis yog1 mus rau 4.
size
aspect_ratio
quality
negative_prompt
output_format
ximTsis yogTxog kev tsim.
response_formatximTsis yog"b64_json" (lub ntsiab lus pib ntawm no) lossis "url".

Lub duab uas koj upload yuav raug soj ntsuam seb yog PNG, JPEG, WebP lossis GIF uas zoo, raug xa mus nrog nws hom tsuas, thiab raug tso rau hauv Blossom host uas pejtheem pom, vim tias cov generators yuav rub cov ntaub ntawv los ntawm link. Saib nws xws li ib yam uas pejtheem pom. Yog tias kev hloov kho tsis ua tau thiab tsis muaj dab tsi raug them nqi, lub copy uas tso rau ntawd yuav raug muab tshem tawm rov qab. Kev teb yuav muaj zaj lus zoo nkaus li thaum tsim (generation). Tus nqi yog tus nqi ntawm tus generator, uas rau qee tus generator, nws suav nrog tus nqi rau lub duab uas siv rau kev tsim ntawd.

Teb lus

{
  "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 }
}
Qhov xwm txheejThaum twg
400Tsis muaj duab lossis lus qhia, ib daim ntawv uas tsis yog duab (invalid_image), loss yog ib lub generator uas tsis tuaj yeem hloov kho tau (edit_unsupported).
413Lub duab ntau tshaj 20 MB (file_too_large), los yog tag nrho qhov kev thov dhau 32 MB.
503Lub duab tsis tuaj yeem muab tso rau tam sim no (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

Ib zaj yeeb yam yuav siv ntau feeb, yog li nws yuav khiav hauv sab nraum. Koj xa nws mus, tau tau ib lub id tam sim ntawd, thiab lus nug txog lub id ntawd mus txog thaum nws tiav. Txhua yam video generator yuav siv cov Pro balance.

POST https://nymbot.ai/api/v1/videos — yuav tsum muaj ib daim API key, los yog ib qho kev them nqi Lightning rau txhua qhov kev thov. Kev rov qab los 202.

NtawvSauIb yam xav tauDaim Ntawv Qhia
modelximYog lawmIb lub tshuab tsim video id los ntawm GET /api/v1/models?type=video, xws li veo.
promptximYog lawmDab tsi yuav tsum tshwm sim.
durationtus lej lossis kab lusTsis yogNtev hauv sawv dagg, tshaj 0 mus txog 60. Siv rau cov generator uas tso cai xaiv qhov ntev xwb; lwm cov yuav ua raws li lawv tus ntev qub, uas yog dab tsi seconds hauv kab teb lus thiab tus nqi raug nrog nrog.
aspect_ratioximTsis yogIb yam li "16:9" los yog "9:16"; ib qho loj xws li "1280x720" yuav dhau los ua lub niam txhab uas ze tshaj plaws.
resolution
quality
ximTsis yogIb ntawm cov tshuab tsim hluav taws xob nrog... resolutions hauv cov qauv daim ntawv ntxiv, xws li "720p" los yog "1080p". Nws yog tus tswj tus nqi. Txhua yam tshaj qhov ntawd yuav raug tsis pub. unsupported_resolution.
image_urlximTsis yogIb daim duab pib thaum: ib https:// txuas lossis tshuam data:image/… URL, uas raug tso mus rau ib Blossom host pej xeem ua ntej. Yuav tsum tau siv los ntawm cov generators nrog requires_image_url.

Tus nqi yuav tsis hloov thaum koj xa mus, raws li lub generator, qhov meej xim, thiab qhov ntev, yog li ntawd nws yuav raug nqi ntawm koj Pro balance tam sim uas tus neeg ua haujlwm txais lub haujlwm, thiab qhia li cost, estimated_cost thiab nymbotYog tias tus neeg ua haujlwm tsis kam ua lub haujlwm ntawd, yuav tsis muaj dab tsi raug them nyiaj. Yog tias qhov render tsis tiav tom qab ntawd, lossis qhov clip uas tiav tsis muaj chaw khaws thiab tus neeg ua haujlwm tsis tau them nqi rau nws, lub nqi yuav raug rov xa mus rau hauv ib zaug, tsis tas yuav ua li cas. Ib qho render uas tseem ua tsis tiav tom qab ib teev, yuav raug tseg tsis ua ntxiv, thiab yuav tsis tau rov xa nyiaj, vim tus neeg ua haujlwm yuav them nqi rau qhov render tam sim uas nws lees yuav nws. Kev rov xa nyiaj yuav rov qab cov credits tab sis nws yuav tsis ua rau qhov key txoj kev siv nyiaj qis mus.

Lus teb (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 pib ua li in_progress, los yog completed ntawm lub video nyob hauv lawm data thaum lub tshuab tsim hluav taws xob rov qab los tam sim no.

Saib ib daim video

GET https://nymbot.ai/api/v1/videos/{id} — yuav tsum muaj ib lub chav uas yog ntawm lub nym uas tau xa nws. Ib lub chav uas tau txog qhov txwv ntawm nws tseem tuaj yeem tshawb xyuas tau.

Nws teb 202 thaum daim video tab tom raug ua thiab 200 thaum nws tshyam tas los yog tsis ua tau. Nug txhua tsib txog kaum feeb. Kev tshawb fawb txhua qhov nug tus neeg muab cov ntaub ntawv ib zaug thiab teb ib zaug; nws tsis tau tos lub video li. Ib hauj lwm yuav raug khaws cia rau 24 teev tom qab nws raug xa mus. GET /api/v1/videos thaum ntej ntawm cov hauj lwm 50 uas kawg ntawm lub luag hauj lwm no yog {"object": "list", "data": […]}.

Lus teb (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 yog in_progress, completed los yog failed. A lub luag hauj lwm uas tsis tiav nqa mus nrog error ({"code": "generation_failed", "message": …}); yog tias raug them nyiaj rov qab,] cost 0 thiab nymbot ntxiv refunded_credits thiab refunded_satsLub video uas tiav lawm yog nyob ntawm ib qho Blossom public host, zoo li cov duab uas tsim tawm los.

Qhov xwm txheejThaum twg
400Tsis muaj lus qhia; lub sijhawm nyob rau ntawm 0 mus rau 60 (invalid_value); ib q qhov kev daws teeb meem uas tus tsim tsis muaj (unsupported_resolution); tsis muaj daim duab rau lub generator uas xav tau ib daim (image_required); ib lub model uas tsis yog ib lub video generator (invalid_model).
402Lub Pro balance tsis tuaj yeem npog lub video.
404Tsis muaj tshuab tsim (model_not_found), los yog tsis muaj haujlwm ntawm lub ID ntawd rau koj npe, los yog nws dhau 24 teev lawm (video_not_found).
429Koj lub npe npe twb muaj 10 daim video tab tom tsim tawm lawm (video_jobs_limit). Saib seb lawv xog li cas thiab xa ntxiv thaum ib yam tiav.
502Lub tshuab tsim hluav taws xob tsis kam ua hauj lwm ntawd. Tsis muaj dab tsi raug them nqi tsis yog tus neeg ua hauj lwm tau xa nqi rau nws.
503Nkauj yeeb tsis tuaj yeeb lossis tsis muaj chaw khaws tam sim no (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);

Kev hais lus los ntawm ntawv

Ntawm cov ntawv uas nyeem thiab rov qab xa cov suab ncaj qha, tsis yog ib qho link. Nws yog OpenAI lub speech endpoint, thiaj li audio.speech.create hauv OpenAI SDKs ua hauj lwm.

POST https://nymbot.ai/api/v1/audio/speech — yuav tsum muaj ib daim API key, los yog ib qho kev them nqi Lightning rau txhua qhov kev thov.

NtawvSauIb yam xav tauDaim Ntawv Qhia
modelximTsis yogIb hom lus hais los ntawm lub npe ntawm cov audio models. Lub hauv paus: lub suab ntawm txhua yam, @cf/myshell-ai/melotts. aura-2 Deepgram Aura 2 puas yog.
inputximYog lawmNqe lus yuav tau nyeem: txog 800 cov ntawv rau lub suab tib neeg (standard voice), 2,000 rau Aura 2.
voiceximTsis yogIb lub suab id los ntawm lub npe ntawm cov suab: ib lub Aura hauv suab xws li luna (los yog aura-2-luna-en), los yog ib hom lus MeloTTS (en, es, fr, zh). OpenAI suab cov npe xws li alloy tau lees txais thiab muab lub suab tsis hloov ntawm lub model.
languageximTsis yogIb hom lus code xws li es. Ua tsis muaj lub suab, nws xaiv ib lub suab rau ntawd rau lwm hom lus. Ib lub suab uas hais lwm hom lus yuav rov qab los 422 voice_language_mismatch, thiab ib hom lus uas lub model tsis muaj suab rau 422 unsupported_language.
response_formatximTsis yogLub suab tseg tseg rov qab los mp3 xwb. Aura 2 rov los mp3 (lub tswv yim pib), opus, aac, flac, wav los yog pcm.
speedtus lejTsis yogTxog thiab tsis tshwm sim.

Lub suab ntawm qauv nqi yog 3 credits (30 sats) rau txhua qhov kev thov, ib yam li hauv app. Aura 2 yog Pro, uas nqi raws li cov ntawv koj xa mus. Lub tswv yim teb yog lub suab, nrog rau ib yam ntxiv uas haum nrog nws Content-Type; tus nqi nyob rau hauv X-Nymbot-Cost-Sats header. Yog tias lub speech model tsis ua hauj lwm, tsis yuav tsum them dab tsi.

Teb lus

HTTP/1.1 200 OK
Content-Type: audio/mpeg
X-Nymbot-Cost-Sats: 4.2
X-Nymbot-Balance-Sats: 41055.6

(audio bytes)
Qhov xwm txheejThaum twg
400Tsis muaj input; input dhau ntawm qhov tsim nyog rau lub model (input_too_long); ib hom tswv yim uas qauv no tsis tuaj yeem tsim tau (unsupported_response_format); ib lub suab uas tsis paub tias yog leej twg (invalid_voice); ib lub model uas tsis yog ib lub speech model (invalid_model).
422Lub suab tsis hais cov lus uas muaj, los yog tus model tsis muaj suab rau qhov ntawd.
502Lub ntsiab lus hais tsis ua tiav. Tsis muaj dab tsi raug them nyiaj.

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()));

Cov qauv suab thiab cov suab lus

Ob pej xeem daim ntawv rau kev xaiv ib lub lus hais model thiab lub suab, lossis ib lub lus tshawb fawb model. Muaj 41 Aura 2 English speakers thiab peb MeloTTS cov lus.

GET https://nymbot.ai/api/v1/audio/models — tsis tas siv lub nplooj ntawv txhua lub cim.

GET https://nymbot.ai/api/v1/audio/voices?language=en — tsis tas siv lub nplooj ntawv txhua lub cim.

NtawvSauIb yam xav tauDaim Ntawv Qhia
languagentais (kev nug)Tsis yogTsuas yog cov suab rau lub lus no xwb.
modelntais (kev nug)Tsis yogTsuas yog cov suab rau lub model no xwb.

Lus teb (suab lus)

{
  "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 }
  ]
}

Cov qauv daim ntawv teb {"object": "list", "data": {"tts": […], "stt": […]}}. Txhua lub qauv hais lus muab nws tus xyem xyem, tus nqi, max_input_chars, response_formats, languages thiab default_voice; qhov lub qauv tshawb xyuas ntawv qhia nws cov npe hu lwm, max_file_bytes, max_seconds, lub tswv yim thiab tus nqi ntawm feeb txhua feeb.

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

Nqe lus mus rau ntawv sau

Hlo Whisper siv los hloov ib qho kev pob zeb mus ua ntawv ntawv. Qhov no yog OpenAI txoj kev txheeb xyuas ntawv, yog li ntawd audio.transcriptions.create ua hauj lwm.

POST https://nymbot.ai/api/v1/audio/transcriptions — yuav tsum muaj ib daim API key, los yog ib qho kev them nqi Lightning rau txhua qhov kev thovLub cev yog multipart/form-data.

NtawvSauIb yam xav tauDaim Ntawv Qhia
filentau ntawvYog lawmKev qhia tau, ntawm 256 bytes mus rau 25 MB thiab mus txog 30 feeb: WAV, WebM, MP4 lossis M4A, Ogg lossis Opus, MP3 thiab lwm yam hom uas Whisper nyeem tau. MP3 thiab lwm yam hom uas tsis tau nyeem tau nws lub ntev ntawm thaum pib yog txwv rau 1.8 MB.
modelximTsis yogTsis tau teeb tsa whisper, uas yog Whisper Large v3 Turbo. whisper-1, whisper-large-v3-turbo thiab @cf/openai/whisper-large-v3-turbo txhais tau zoo ib yam.
languageximTsis yogLo lus hais, xws li en. Pom tau yog tso tseg.
promptximTsis yogCov lus loss otherwise yog cov kev sau uas yuav tau ntsib, xws li cov npe. Tsuas siv 1,000 tus ntawv thawj uas yog rau qhov xwb.
response_formatximTsis yogjson (lub tswv yim pib), text, srt, vtt los yog verbose_json.

rau cov ntawv WAV, WebM, MP4 thiab Ogg, qhov ntev yog raug nyeem los ntawm lub faib ua ntej txhua yam pib ua, yog li ntawd kev thaum sau ntau tshaj 30 feeb yog raug tsis pub tseg tsis hais li (thiab muaj 3 feeb ntxiv). Qhov ntev ntawm ib daim WAV file yog tuaj ntawm nws qhov sample rate, channels thiab sample size. Qhov ntev ntawm lwm hom file, xws li MP3, tsis tuaj yeem nyeem tau tsis hais li, yog li ntawd lawv raug txwv los ntawm qhov loj: ntawm qhov bitrate qoll tshaj plaws uas Nymbot pom tias, 8 kbps, 30 feeb yog 1.8 MB, thiab ib daim file uas loj dua hauv qhov hom ntawd yuav raug tsis pub nrog 413 audio_too_long ua ntej txhua yam yuav pib. xa cov suab ntev ntau zog ua WAV, WebM, MP4 lossis Ogg. Yog tias Whisper qhia tias ntau tshaj 30 feeb, thiaj tsis lees txais nrog 413 audio_too_long, thiab vim tias Whisper tau khiav, 30 feeb yog raug them nyiaj.

Koj yuav them rau lub sijhawm ntawm lub suab, uas raug ntxiv mus rau feeb: lub sijhawm ntev tshaj plaws ntawm cov uas nyeem tau los ntawm daim ntawv, lub sijhawm uas Whisper qhia, thiab lub sijhawm tsawg tshaj plaws uas qhov loj ntawm daim ntawv tso cai, ntawm Whisper tus nqi feeb ib feeb nrog rau cov nuj nqi thiab margin li qub, thiab tsis pub tsawg dua 0.05 credit rau txhua qhov kev thov. Nws yuav raug them los ntawm standard balance thaum nws txaus rau qhov yuav tsum them, thiab los ntawm Pro yog tias tsis yog li ntawd; a 402 qhia tias txhua tus nqi yuav tsum muaj dab tsi. Hauv lub app, kev sau lus los ntawm suab tuaj yeem yog dawb; hauv API nws yog yuav tsum tau them nqi txhua lub sijhawm. Yog tias Whisper tsis ua haujlwm, tsis muaj dab tsi raug them nqi.

Teb lus

{
  "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 yug tshuab ntawv tsis muaj duab, srt thiab vtt muab cov lus qhia rov qab, thiab verbose_json ntxiv cov lus, lub sijhawm, thiab cov feem sijhawm. Rau peb uas tsis yog JSON, tus nqi nyob rau hauv cov headers.

Qhov xwm txheejThaum twg
400Tsis muaj daim ntawv, ib daim ntawv uas tsis muaj suab uas siv tau (()invalid_audio), ib hom tshawb tsis tau, lossis ib lub model uas tsis yog ib lub transcription model (invalid_model).
402Tsis muaj ib lub hli txiaj ntsim twg yuav txuas tau nrog nws.
413Daim ntawv yog tshaj 25 MB (file_too_large) loss ntawm daim suab ntev tshaj 30 feeb, lossis, nyob rau hauv ib hom tswv yim uas tsis tau nyeem tau nws qhov ntev thaum pib, tshaj 1.8 MB (audio_too_long).
502Whisper tsis tau ua tiav cov suab. Tsis muaj dab tsi raug them nyiaj.

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

Txhais lus hais ua lus Askiv

POST https://nymbot.ai/api/v1/audio/translations — yuav tsum muaj ib daim API key, los yog ib qho kev them nqi Lightning rau txhua qhov kev thovLub cev yog multipart/form-data.

Ib yam nkaus li kev sau ntawv, nrog cov qhov chaw *@* zoo nkaus li lwm qhov yog tsis muaj language, qhov tshuaj txiav txim thiab tus nqi, tab sis cov ntawv rov qab los ua lus Askiv txhua hom lus uas tau hais. OpenAI SDKs hu nws nrog 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

Hlo lwm yam ntawv mus ua vectors rau kev nrhiav, kev sib sau ua ke, thiab kev tshem tawm cov uas zoo ib yam. Cov model no khiav ntawm Cloudflare thiab siv cov nyiaj txiag uas muaj nyob rau.

POST https://nymbot.ai/api/v1/embeddings — yuav tsum muaj ib daim API key, los yog ib qho kev them nqi Lightning rau txhua qhov kev thov.

NtawvSauIb yam xav tauDaim Ntawv Qhia
modelximYog lawmIb qho embedding model los ntawm GET /api/v1/models?type=embedding.
inputtxheej ntxwv lossis ib pab ntawm cov txheej ntxwvYog lawmNqe lus uas yuav tsum muab tso rau, txog 100 cov kab lus uas tsis yog khoob. Cov token arrays yuav raug tsis txhaws mus (token_input_unsupported). Txhua lub input yuav tsum haum rau qhov model's context_length, suav tau li peb peb nqe bytes ib qho token.
encoding_formatximTsis yogfloat (tus tswv yim ntawm hauv) lossis base64 (little-endian 32-bit floats).
dimensionstus lej txhua ntuTsis yogQhov loj ntawm tus model nws tus kheej, los yog rau ib lub model uas muaj supported_dimensions ib yam ntawm cov ntawd; tom qab ntawd lub vector yuav raug txo thiab normalized. Tsis yog lwm yam li yuav raug tsis pub.
YeejKev ntev davNtsiab lus
@cf/baai/bge-m31024, ntau hom lus8,192 cov lus (tokens)
@cf/qwen/qwen3-embedding-0.6b1024, ntau hom lus8,192 cov lus (tokens)
@cf/baai/bge-large-en-v1.51024, Askiv512 cov lus nqe
@cf/baai/bge-base-en-v1.5768, Askiv512 cov lus nqe
@cf/baai/bge-small-en-v1.5384, Hmoob512 cov lus nqe

Lub npe ntawm cov model yog qhov tseeb rau qhov uas muaj thiab lawv txhua tus muaj nqi npaum li cas; Google's EmbeddingGemma, uas muaj cov vector luv dua thaum thov, pom zoo hauv ntawd thiab thaum catalog muaj tus nqi rau nws. Kev ua Embeddings yog raug them raws li txhua input token, thiab tus nqi 0.05-credit qis tshaj plaws yuav siv rau txhua thov (request), tsis yog rau txhua input, yog li ntawd kev muab ntawv ntau ua ib thov (batching) yog qhov pheejayam dua rau kev xa mus ib qho ib zaug.

Teb lus

{
  "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 }
}
Qhov xwm txheejThaum twg
400Tsis muaj input loss yog ib yam khoov; token arrays (token_input_unsupported); tshaj li 100 cov input (too_many_inputs); ib qho kev nkag mus uas ntev tshaj qhov qauv (input_too_long); ib qho ntau uas tus model tsis tuaj yeem muab tau (unsupported_dimensions).
402Lub nqi tshuaj tsim tshuaj tsis zoo heev. Cov embeddings tsis tau siv lub Pro balance li.
404Tsis muaj embedding model uas muaj lub npe ntawd.
502Lub tshuab tsis ua tau raws li siab xav. Tsis muaj dab tsi raug them nyiaj.

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