BelugAPI Documentation
One gateway, every leading AI model. BelugAPI exposes an OpenAI-compatible REST API — change one line of code and access 200+ models at up to 70% below official prices.
base_url and your API key.Base URL
All API requests are made to the following base URL.
https://api.belugapi.com/v1
Authentication
All requests (except GET /v1/models and GET /v1/health) require a Bearer token in the Authorization header. API keys start with bapi_.
Authorization: Bearer bapi_your_api_key_here
Endpoints
BelugAPI provides the following endpoint groups.
Liveness probe. Returns API status, catalog health, and database connectivity. No auth required.
List all available models. Supports filtering by category, provider, and full-text search. Auth optional.
Retrieve detailed info for a single model by its ID slug.
Send a message list to any LLM. Supports streaming (SSE), function calling, vision, and system prompts.
Generate images from text prompts. Transparent async polling — BelugAPI returns URLs directly once generation completes.
Submit a video generation task. Returns a task_id immediately; poll the task endpoint to get the video URL.
Poll video generation status. When status becomes completed, the response includes the downloadable video URL.
Convert text to speech (TTS). Streams binary audio in your chosen format (mp3, wav, flac…).
Transcribe audio to text (STT). Send a multipart/form-data request with your audio file.
Quick example
Get up and running with a single API call.
from openai import OpenAI client = OpenAI( api_key="bapi_your_key_here", base_url="https://api.belugapi.com/v1" ) response = client.chat.completions.create( model="gpt-5.4", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ apiKey: "bapi_your_key_here", baseURL: "https://api.belugapi.com/v1", }); const response = await client.chat.completions.create({ model: "gpt-5.4", messages: [{ role: "user", content: "Hello!" }], }); console.log(response.choices[0].message.content);
curl https://api.belugapi.com/v1/chat/completions \ -H "Authorization: Bearer bapi_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4", "messages": [{"role": "user", "content": "Hello!"}] }'
Response format
All responses follow the OpenAI JSON schema. Errors always return a top-level error object with message, type, and optional code.
{
"error": {
"message": "The model 'foo' does not exist.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}
SDKs & Libraries
Because BelugAPI is OpenAI-compatible, you can use any OpenAI SDK with a one-line change.
| Language | Install | Config change |
|---|---|---|
| Python | pip install openai | Set base_url="https://api.belugapi.com/v1" |
| Node.js | npm install openai | Set baseURL: "https://api.belugapi.com/v1" |
| Go | go get github.com/sashabaranov/go-openai | Pass custom ClientConfig with BaseURL |
| REST | — | Send requests directly to https://api.belugapi.com/v1 |