Tīpoka ki te ihirangi
Hoki ki a Nymbot

Te turanga matauranga Kaiwhakawhanake

Ngā whakaahua, te rongo, me ngā embeddings

Ngā generator mai i te app, me ngā waahanga matua mō te rapu: ngā whakaahua, te wikī, te kōrero, te tuhituhi, me ngā embeddings, e utu ana i ia whakamahinga i tō tauira pūtea.

Whakakāinga whakaahua

Ka hangaia he whāriki pikitia tekau mā whā i raro i te tohutohu, ā, ka hoki mai rātou i te wā kua oti. Ko te rārangi pūnaha hanga tō tahi atu 🌊 ?image i roto i te app.

POST https://nymbot.ai/api/v1/images/generations — me he API key, o he utu Lightning mō ia tono.

Mai i hea ngā ID? GET /api/v1/models?type=image. Te generator matua, @cf/black-forest-labs/flux-1-schnell, he 5 standard credits tonu (50 sats) mō tētahi whakaahua. Ko ngā generator katoa atu e whakamahi ana i ngā Pro credits i tōna utu tersu, me te utu me te margin mātua, pēnei i te app. n te utu o ngā whakaahua n ngā wā katoa. He papa kaore e oti e tētahi generator ka tūpono te tūponotanga me te mea he whakahē, engari ka whakamahia e te standard generator te prompt anake.

PapaMahereKia hiahiatia anaWhakaahua
modelkōpakaAeHe tohu generator, pēnei i te nano-banana.
promptkōpakaAeHe aha te mea hei tūtohu. Ko ngā tuatahi 2,000 iwi anake e whakamahia ana.
ntau kōpakaKāore1 ki te 4. Tūtohu 1. Whakaaea hoki hei num_images.
sizekōpakaKāoreHe aha te rerekētanga i te āhua pēnei i te "16:9", rānei he nui OpenAI pēnei i te "1792x1024", e huri ana ki te mea tino tata ki te 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 5:4 me te 4:5. "auto" ka waiho ki te kaihanga.
aspect_ratiokōpakaKāoreTe mea pēnei i te size, ā, ka toa ki te kawea katoa.
qualitykōpakaKāoreTūtohu-mō te generator, pēnei i te "low", "medium" kei te mea anō "high".
negative_promptkōpakaKāoreHe aha te mea hei whakarere.
output_formatkōpakaKāore"png", "jpeg" kei te mea anō "webp".
response_formatkōpakaKāore"url" (te tūtohu) rānei "b64_json".
image_urlkōpakaKāoreHe pikitia hei tīmata mai: he https:// hononga e kaua e riro atu i te 4,096 ngā tohu me kāore he ingoa rānei, he pāpāho rānei kei roto, ki te a data:image/…;base64 URL (PNG, JPEG, WebP rānei GIF; kaua SVG). Mō ngā kaihangatanga anake e whai ana i edit; e hiahia ana te hunga kei roto i requires_image_url.

resolution kāore e whakamahia: ka hanga i tōna ake nui ia generator. Me url, ka tukuna ia pikitia ki tētahi Blossom host kōpaka, ā, ka whiwhi koe i tōna hononga (he mea tukuna anō tētahi hononga i roto i ētahi generators anake, e tuku ana). Ko tēnā katoa e whai ana i te hononga ka taea te whakatuwhera, ā e kore e taea te whakakore anō; tirohia he aha te mea ka kite te API. Me te b64_json ka hoki mai te pikitia ki te whakautu, ā, kāore i whakaatihia i te pikinga. He pikitia i ngana kia puāwai kia a data: URL ki roto image_url he otiotia pēnei i te henei anō? whakapai ake ā, ka tukuna ki Blossom i mua kia taea e te generator te tango i a ia; ka tango anō iho i te rā kei te raru te tono i te kore utu.

Mehemea he iti o te n ka hē ngā whakaahua, ka whiwhi koe i ngā kua mahi, ka utu koe mō ō rātou anake (me ngā mea i whakatau utu te kaiwhakarato ahakoa kua hē), me nymbot.failed e kī ana he maha kei te ngaro. Ki te ngana katoa e kore e taea, ka hoki te tono 502.

Whakaaronga

{
  "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 }
}
Tikanga MatuaAhihi
400Kāore he tohutohu; n waho 1 ki 4 (invalid_value); he nui rawa te nui (invalid_size) rānei te pikitia (invalid_image, invalid_image_url); he tauira kei te watea engari ehara i te kaihanganga whakaahua (invalid_model); he whakaahua mō tētahi kaihangā e kore e taea te whakatika (edit_unsupported); kāore he whakaahua mō tētahi e hiahia ana ki tēnā (image_required).
402Kaore te tauira e taea te whāia i ngā whakaahua katoa i kōrerotia.
404Kāore he tauira i tēnei ingoa (model_not_found).
502Kua pakaru te generator (upstream_error). Kāore he utu he mea ka whai utu i te mea ka whakataki te kaiwhakahaere mō te whakamātau; i tēnā wā, kua whai te raru i charged_sats.
503Kāore e taea te whakautu i ngā whakaahua i tēnei wā (media_hosting_unavailable). b64_json tonu ana te mahi.

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

Whakapai ake i ngā whakaahua

Whakakāinga i tētahi pikitia e whakatoinga ana koe, e whai ana i tētahi whakahau. He wāhi whakakāinga tēnei a OpenAI, nō reira ngā SDK a OpenAI... images.edit e mahi ana hei katoa. Ko ngā kaihanga Pro anake e rite ana me edit i te rārangi tauira whakaaehia.

POST https://nymbot.ai/api/v1/images/edits — me he API key, o he utu Lightning mō ia tono. Ko te tinana multipart/form-data, ki te 32 MB.

PapaMahereKia hiahiatia anaWhakaahua
imagepukapukaAeTe pikitia hei whakatika: PNG, JPEG, WebP rānei GIF, kia tae atu ki te 20 MB. He mea tātari hoki hei image[]; ko te tuatahi kua whakamahia.
promptkōpakaAeHe aha te mea hei whakatika.
modelkōpakaAeHe generator me te edit.
ntau kōpakaKāore1 ki te 4.
size
aspect_ratio
quality
negative_prompt
output_format
kōpakaKāoreMā te whakatupuranga.
response_formatkōpakaKāore"b64_json" (te tautuhing matua i konei) rānei "url".

Ka whakamātauhia te pikitia e tupeke ana koe kia PNG, JPEG, WebP rānei GIF hāngai, ka tūnga ana hei momo tika, ā, ka waiho ki runga i te whaitere Blossom mātāmua, nō te mea ka piki ake ngā mea hanga i tō rātou input mā te tautuhi. Whakaarohia kia tūmatanui. Ki te kore e taea te whakatika ā, kāore he utu, ka mutu ka riro atu te kopia i te whaitere. He rite te āhua o te whakautu ki te hanga. Ko te utu te utu a te mea hanga, ā, mō ētahi mea hanga, ka whai ake te utu mō te pikitia input.

Whakaaronga

{
  "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 }
}
Tikanga MatuaAhihi
400Kāore he pikitia, he whakamātau rānei, he pūnaha e kore ko te pikitia (invalid_image), rānei he kaihangaputa e kore e taea te whakatika (edit_unsupported).
413He nui atu i te 20 MB te pikitia (file_too_large), i te rātaitai katoa e neke atu i te 32 MB.
503E kore e taea te whakautu i te whakaahua i tēnei wā (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"));

Whakaata

He minute katoa te take o te wikī, nō reira ka oma i te papamahi. Ka tukuna koe, ka whiwhi i te id tonu, ā ka pātai i te id ki te rārangi katoa. Ka whakamahi katoa ngā whakangao wikī i te tauira Pro.

POST https://nymbot.ai/api/v1/videos — me he API key, o he utu Lightning mō ia tono. He hokinga 202.

PapaMahereKia hiahiatia anaWhakaahua
modelkōpakaAeHe id hanganga ataata mai i GET /api/v1/models?type=video, pēnei i te veo.
promptkōpakaAeHe aha me tupu.
durationtau rānei rārangi kupuKāoreTe roa i ngā hētika, neke atu i te 0 ki te 60. Ka whakamahia anake e ngā kaiwhakawhanake e whakaatu ana i te kōwhiringa roa; ko ngā tētahi anō ka hanga i tō rātou roa mātua, koia tēnei e aha ana seconds i roto i te whakautu me te utu e whai ake nei.
aspect_ratiokōpakaKāorePēnei i te "16:9" kei te mea anō "9:16"; he nui pēnei i te "1280x720" hei te rāwhiti tino tata.
resolution
quality
kōpakaKāoreTētahi o ngā generator resolutions i roto i te rārangi tauira, pēnei i "720p" kei te mea anō "1080p". Ko ia te whakatau i te utu. Ko ngā mea atu katoa ka whakahēria ki te unsupported_resolution.
image_urlkōpakaKāoreHe pikitia hei tīmata mai: he https:// hononga rānei he data:image/… URL, ka whakamengia ki tētahi Blossom host kōpaka i mua i te tukungia. Kia hiahiatia e ngā kaiwhakakapi me te requires_image_url.

Ka whakaritea te utu i te wā e tuku ana koe, e te kaihanga, te whakaaturanga, me te roa, nō reira ka tango i tō tauira Pro i te wā tonu e whakaae ana te kaiata i te mahi, ā ka whakaaturia hei cost, estimated_cost a nymbotKi te whakahē te kaiwhakahaere i te mahi, e kore e whai utu. Ki te raru te render ā muri ake nei, rānei, ki te kore e taea te tiaki i te clip i oti, ā, kāore te kaiwhakahaere i whāngai utu mō ia, ka hoki te utu ki te hunga whai i tētahi wā, i runga i te katoa. Ko te render e haere tonu ana i muri i tētahi awā ka whakamuturutia, ā, ka noho tonu te utu, no te mea ka whāngai utu te kaiwhakahaere i te render i te wā e whakaae ana ia ki tērā. Ko te hoki utu ka hoki mai ngā tūtohu engari e kore e whakaiti i te tau tau whakangia o te tuhinga.

Whakautu (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 tīmata hei in_progress, ki te mea ko completed me te wiki kua ingoa mai data i te wā i hoki mai ai te generator i te kōpaka tonu.

E tiro ana i tētahi ataata

GET https://nymbot.ai/api/v1/videos/{id} — me he kī e noa ana ki te nym i tuku mai i a ia. He kī kua tae ki tōna rārangi katoa ka taea tonu te tirotiro.

He whakautu ia 202 i te wā e hangaia ana te wikiata, me te 200 inā oti ana te mahi, nō te mea kua hinga rānei. Pātai i ngā hāora 5 ki te 10 i ia wā. Ko ia tūtohu ka pātai i te kaiwhakawhiti he tahi anō, ā, ka whakautu i te wā tonu; e kore e tatari i te ataata. Ka tiakina te mahi mō te 24 iho i muri i te tuku i a ia. GET /api/v1/videos tuhituhi i ngā mahi 50 o te tohu i te whakamutunga hei {"object": "list", "data": […]}.

Whakautu (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 he in_progress, completed kei te mea anō failed. A he mahi kore pea ka whai ake error ({"code": "generation_failed", "message": …}); mehemea i tukuna atu te moni whakawātea, cost he 0 me te nymbot tāpirihia refunded_credits a refunded_satsKo te wikiti kua oti kei runga i tētahi Blossom host tūmatanui, pēnei i ngā whakaahua kua hangaia.

Tikanga MatuaAhihi
400Kāore he tono; he wā e waho o te 0 ki te 60 (invalid_value); he whāutitanga kāore e tohu ana te kaihangenera (unsupported_resolution); kāore he pikitia mō tētahi generator e hiahia ana ki tētahi (image_required); he tauira kāore he mea whakakārihi ataata (invalid_model).
402Kaore e taea te tauira Pro e whakoa i te wikiti.
404Kāore he pūrangi pēnei (model_not_found), kāore rānei he mahi mā tēnā id mō tō nym, rānei kua neke atu i te 24 hāora (video_not_found).
429Kua 10 ngā wikapi e whakarite ana tōu nym (video_jobs_limit). Tirohia rātou, ā, tuku atu atu i te mutunga o tētahi.
502Kaitukuna te raru i te mahi. Kāore he utu ātea kia utu ai i te mea kāore i whiti te kaiwhakarite i tēnā.
503Kāore e taea te tuku atu rānei te noho kaupao i ngā wikī i tēnei wā (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);

He kupu ki te reo whakarongo

Ka pānui i te tuhinga ki te reo kōrero, ā, ka hoki mai te waiata rā anake, ehara i tētahi hononga. He pūtake kōrero reo nō OpenAI tēnei, nō reira audio.speech.create ki roto i ngā OpenAI SDKs e mahi ana.

POST https://nymbot.ai/api/v1/audio/speech — me he API key, o he utu Lightning mō ia tono.

PapaMahereKia hiahiatia anaWhakaahua
modelkōpakaKāoreHe mahata kōrero mai i te rārangi tauira ōtio. Tūāpapa: te reo matua, @cf/myshell-ai/melotts. aura-2 He Deepgram Aura 2 rā?
inputkōpakaAeTe tuhinga hei pānui: he tae noa ki te 800 ngā tohu mō te reo taketake, he 2,000 mō Aura 2.
voicekōpakaKāoreHe reo tohu mai i te rārangi o ngā reo: he speaker Aura pērā i luna (or aura-2-luna-en), rānei he reo MeloTTS (en, es, fr, zh). Ngā ingoa reo o OpenAI pēnei i te alloy e whakaaeatia ana, ā ka tuku i te reo matua o te tauira.
languagekōpakaKāoreHe kōtuhi reo pēnei i te es. Me te kore reo, ka kōwhiria tētahi mō taua reo. He reo e kōrero ana i tētahi reo kē ka hoki mai. 422 voice_language_mismatch, me te reo kāore he reo mā te tauira 422 unsupported_language.
response_formatkōpakaKāoreKa hoki mai te reo tūmatanui mp3 Anakei. Aura 2 hoki mai ana mp3 (te tirohanga matua), opus, aac, flac, wav kei te mea anō pcm.
speedtauKāoreTāmategia ā, kore i whakaatu.

He utu tūturu te reo matua he 3 kura matua (30 sats) i ia talanoa, pēnei i te tuhituhi i roto i te app. He Pro a Aura 2, he utu e pā ana ki ngā tuhituhi e tukuna ana koe. Ko te taha whakautu he rongo, me tētahi e hāngai ana Content-Type; kei roto i te utu te X-Nymbot-Cost-Sats hautū. Ki te hapa te tauira kōrero, e kore e whiti te utu.

Whakaaronga

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

(audio bytes)
Tikanga MatuaAhihi
400Kāore he whakauru; kua neke atu te whakauru i te raru o te tauira (input_too_long); he aha te hanga e kore e taea e te mahere e hanga ai (unsupported_response_format); he reo kāore i mōhiohia (invalid_voice); he tauira kāore he tauira kōrero (invalid_model).
422Kāore te reo e kōrero i te reo kua whakahauhia, rānei, kāore he reo kei te tauira mō ia.
502Kua pakaru te tauira kōrero. Kāore he mea i utuia.

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

Ngā mahere rongo me ngā reo

E rua ngā rārangi tūmatanui mō te kōwhiringa i te tauira whaikōrero me te reo, i te tauira tuhituhi hoki. He 41 ngā kōrero reo Ingarihi Aura 2 me e whā ngā reo MeloTTS.

GET https://nymbot.ai/api/v1/audio/models — kāore he kī e hiahiatia ana.

GET https://nymbot.ai/api/v1/audio/voices?language=en — kāore he kī e hiahiatia ana.

PapaMahereKia hiahiatia anaWhakaahua
languagestring (pātai)KāoreKo te reo nei anake te reo.
modelstring (pātai)KāoreKo ngā reo noa iho mō tēnei tauira.

Whakautu (ngā reo)

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

Ko te rārangi o ngā tauira ngā whakautu {"object": "list", "data": {"tts": […], "stt": […]}}. Ko te tauira kōrero katoa ka tukuna ana tana taurite, tana utu, max_input_chars, response_formats, languages a default_voice; ko te teina tuhinga e whakarongo ana i ōna ingoa tuawhitia, max_file_bytes, max_seconds, hanganga me te utu mō ia meneti.

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

Kōrero ki te tuhinga

Whakamoemoeā i tētahi whakatakoto hei tuhinga mā Whisper. Koinei te tūtohu tuhinga a OpenAI, nō reira audio.transcriptions.create ka mahi.

POST https://nymbot.ai/api/v1/audio/transcriptions — me he API key, o he utu Lightning mō ia tono. Ko te tinana multipart/form-data.

PapaMahereKia hiahiatia anaWhakaahua
filepukapukaAeKo te tuhituhi, mai i te 256 bytes ki te 25 MB me te tae atu ki te 30 meneti: WAV, WebM, MP4 rānei M4A, Ogg rānei Opus, MP3 me ngā auaha anō e pānui ana a Whisper. Ko te MP3 me ngā auaha anō e kore e taea te pānui i te roa o te waiata i mua, ka whakahauatia ki te 1.8 MB.
modelkōpakaKāoreTūāpapa whisper, ko Whisper Large v3 Turbo tēnā. whisper-1, whisper-large-v3-turbo a @cf/openai/whisper-large-v3-turbo e tatea ana i te mea kotahi.
languagekōpakaKāoreKo te reo kōrero, pēnei i te en. Ka kitea mehemea ka whakarerehia.
promptkōpakaKāoreNgā kupu rānei ngā whakamāoritanga hei tatari, pēnei i ngā ingoa. Ko te 1,000 o ngā tuhituatanga o mua anake e whakamahia ana.
response_formatkōpakaKāorejson (te tirohanga matua), text, srt, vtt kei te mea anō verbose_json.

Mō ngā WAV, WebM, MP4 me ngā Ogg, ka pānuhia te roa i te mahi i mua i te tīmata i tētahi mea, nō reira, ka whakahētia he tuhituhi neke atu i te 30 meneti i te tīmatanga tonu (me 3 meneti puku). Ko te roa o te WAV e tae mai ana i tōna rate tauira, ngā awahera, me te rahi tauira. Ko te roa o ngā aha āhua atu, pēnei i te MP3, e kore e taea te pānui i mua, nō reira he rāhuihia rānei e te rahi: i te bitrate iti rawa e whakaaro ai a Nymbot, 8 kbps, ko te 30 meneti ko te 1.8 MB, ā, ka whakahēhia he tārua nui ake i tēnei āhua me 413 audio_too_long mā mua i te mea katoa e tīmata ana. Tuku ngā rēkōtanga roa ake hei WAV, WebM, MP4 rānei Ogg. Ki te pānui a Whisper i te mea he neke atu i te 30 meneti, ka whakahēia te tono me te 413 audio_too_long, ā, i te mea i whakahaerea a Whisper, ka tuhia he 30 meneti.

Ko te utu mō te roa o te rongo, e pūtea ana ki te tahua i te hātepe i te hātepe i te hātepe i te hātepa: te roa rawa o te roa kua pānuihia i te pūrere, te roa a Whisper e pānui ana, me te iti rawa e whakaaetia ana e te nui o te pūrere, i te utu a Whisper mō te minute me te utu me te maranui o noa, ā, kia neke atu i te 0.05 credit i te tono rārangi. Ka whakamutunga mai i te tahua mātāmua ki te taea e ia te whāngai i te tūhononga, ā, mai i te Pro i te wā kia kore ai; a 402 e whakaatu ana he aha te hiahia o ia tauira. I te app, ka taea te tuhi i te reo i te mea i ata free; i te API, ka whakaute i te utu i ngā wā katoa. Ki te kore e mahi a Whisper, e kore e whai utu.

Whakaaronga

{
  "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 whakahoki mai i te tekiti noa, srt a vtt whakahoki i ngā subtitles, ā verbose_json ka tūmataiti te reo, te roa, me ngā waahanga wāhi. Mō te toru e kore e JSON, kei roto i ngā rārangi ingoa te utu.

Tikanga MatuaAhihi
400Kāore he pūtea, he pūtea me te kore rongo i taea te whakamahi (invalid_audio), he hanganga kāore e mōhiotia, rānei he tauira ehara i te tauira tuhituhi (invalid_model).
402Kāore tetahi o ngā tauira e taea te wh covering i tenei.
413He nui atu i te 25 MB te ihirangi o te faili (file_too_large) rānei te taurangi i te 30 meneti i runga i te rārangi, rānei, i roto i tētahi āhua e kore e taea te pānui i te roa i mua, i te 1.8 MB i runga i te (audio_too_long).
502Kāore i taea e Whisper te whakahaere te rongo. Kāore i utu tētahi mea.

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

Te whakamāori i te kōrero ki te reo Ingarihi

POST https://nymbot.ai/api/v1/audio/translations — me he API key, o he utu Lightning mō ia tono. Ko te tinana multipart/form-data.

Te mea anō i te tuhiwhiti, me ngā kōnga anō i tua atu i te language, ngā whakarāwai me te tauetihi, engari ka hoki mai te tuhinga i te reo Ingarihi ahakoa te reo i kōrerotia. Ka karanga te OpenAI SDKs i tēnā ki te 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);

Whakauru ōku mōteatea

Ka huri i te tuhinga hei vector mō te rapu, te whakarahi, me te whakamārie i ngā mea rerekē. Ka rere ngā tauira i runga i te Cloudflare ā, ka whakamahi i te tauira pūtea matua.

POST https://nymbot.ai/api/v1/embeddings — me he API key, o he utu Lightning mō ia tono.

PapaMahereKia hiahiatia anaWhakaahua
modelkōpakaAeHe mahere embedding mai i GET /api/v1/models?type=embedding.
inputkōrero rānei he rārangi kōreroAeTe tuhinga hei whakauru, ki te 100 ngā rārangi tuhinga e whai kōrero. Ka whakakore i ngā rārangi token (token_input_unsupported). Me whai ake tonu te kōrero o ia whakauru ki te hanga o te mahere context_length, e whitungia ana kia e tauru byte he tokena.
encoding_formatkōpakaKāorefloat (te tūtohu) rānei base64 (little-endian 32-bit floats).
dimensionstau kōpakaKāoreTe nui o te tauira anake, tautahi rānei mō tētahi tauira me supported_dimensions tētahi o ēnei; ka poto ake, ka whakatata hoki te vector. Ka whakaharahara atu he mea anō katoa.
TauiraNgā āhua o te aoHoropaki
@cf/baai/bge-m31024, reo maha8,192 tōkena
@cf/qwen/qwen3-embedding-0.6b1024, reo maha8,192 tōkena
@cf/baai/bge-large-en-v1.51024, reo Pākehā512 tūtohu
@cf/baai/bge-base-en-v1.5768, Te Reo Pākehā512 tūtohu
@cf/baai/bge-small-en-v1.5384, Ingarihi512 tūtohu

Ko te rārangi tauira te puna tika mō te mea kua reri me te utu o ia mea; ko te EmbeddingGemma a Google, me ngā rerenga iti ake i te tono, ka kitea tonu i reira i te wā e whai utu ana te katalog mō ia mea. He tāpiritanga ngā embedding e inenga ana mō ia tōkena whakauru, ā, ka tika te iti rawa o 0.05-kureti mō ia tono, kaua mō ia whakauru, nō reira ko te whakakotahi i ngā tuhinga maha ki roto i tētahi tono he iti ake te utu i te tumanako i te tuku i rātou kotahi kotahi.

Whakaaronga

{
  "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 }
}
Tikanga MatuaAhihi
400Kāore he whakauru rānei he mea kore; ngā rārangi token (token_input_unsupported); nui ake i ngā whakauru 100 (too_many_inputs); he whakauru roa ake i te mea e taea e te tauira kei reira (input_too_long); he nui rawa te nui e kore e taea e te tauira te tuku i a ia (unsupported_dimensions).
402He iti rawa te taurite tūāpapa. Kāore ngā Embeddings e whakamahi i te taurite Pro.
404Kāore he mahere embedding i tērā ingoa.
502Kua raru te tauira. Kāore he utu i takena.

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