Docs Menu & Search

Documentation

Embeddings, Images & Audio

Embeddings for search and RAG, image generation, text-to-speech and transcription — all OpenAI-compatible.

Every endpoint below uses the same key and base URL as chat. Some models are served on their own model-scoped base URL (https://api.nabh.cloud/v1/models/<model-id>) — each model’s page shows the exact URL in its code examples.

Embeddings

POST /v1/embeddings turns text into vectors for semantic search, clustering and RAG. Pass one string or an array; you get one vector per input, in order. Billed per 1K input tokens. Models: bge-multilingual-gemma2 (multilingual), qwen3-embedding-4b (100+ languages, configurable output dimensions).

from openai import OpenAI

client = OpenAI(api_key="nbh_your_key_here", base_url="https://api.nabh.cloud/v1")
res = client.embeddings.create(
    model="bge-multilingual-gemma2",
    input=["How do I reset my password?", "Steps to change account password"],
)
vectors = [d.embedding for d in res.data]   # one vector per input, same order

Image Generation

POST /v1/images/generations with a prompt and n (1–10 images). The image comes back as base64 (b64_json) or a URL depending on the model — handle both. Priced per image; stable-diffusion-xl is currently free.

import base64
from openai import OpenAI

client = OpenAI(api_key="nbh_your_key_here", base_url="https://api.nabh.cloud/v1")
res = client.images.generate(model="stable-diffusion-xl", prompt="A tea stall in Darjeeling at dawn, watercolour", n=1)

img = res.data[0]
if img.b64_json:
    open("out.png", "wb").write(base64.b64decode(img.b64_json))
else:
    print(img.url)

Text to Speech

POST …/audio/speech returns audio bytes (MP3 by default). kokoro-tts has 54 voices across 8 languages (e.g. af_bella, af_sarah, am_adam, bf_emma, bm_george); input up to 8,000 characters. Billed per 1K characters.

curl https://api.nabh.cloud/v1/models/kokoro-tts/audio/speech \
  -H "Authorization: Bearer nbh_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"model": "kokoro-tts", "input": "Namaste! Your order has shipped.", "voice": "af_bella"}' \
  --output speech.mp3

Transcription (Speech to Text)

POST …/audio/transcriptions on the model’s base URL, as multipart/form-data with a file (mp3, wav, m4a, webm…, up to 25 MB) and model. Returns {"text": "…"}. Billed per minute of audio. whisper-large-v3 for accuracy; whisper-large-v3-turbo for speed, on its own base URL https://api.nabh.cloud/v1/models/whisper-large-v3-turbo.

from openai import OpenAI

client = OpenAI(api_key="nbh_your_key_here", base_url="https://api.nabh.cloud/v1/models/whisper-large-v3")
with open("meeting.mp3", "rb") as f:
    print(client.audio.transcriptions.create(model="whisper-large-v3", file=f).text)

Try all of these without writing code in the playground — pick the model and use View Code to get the request.