Developer API

Developer API

Use your BotHub balance to call chat, image, video and embedding models from your own code.

BotHub exposes an OpenAI-compatible HTTP API. The balance in your BotHub account can be spent directly from your own programs and scripts — or by an AI assistant you hand the credentials to.

Because the API is OpenAI-compatible, anything that accepts a custom base URL and API key works out of the box: the official OpenAI SDKs, LangChain, most desktop clients, and coding assistants like Claude or Codex.

Base URL and authentication

https://bothub-api.bookab.info/v1

Send your API key with every request:

Authorization: Bearer bhk_live_xxxxxxxx

With an OpenAI SDK, only two parameters change:

from openai import OpenAI

client = OpenAI(
    base_url="https://bothub-api.bookab.info/v1",
    api_key="bhk_live_xxxxxxxx",
)

resp = client.chat.completions.create(
    model="gpt-5.4",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

Start by listing the models

Don't guess model names. One call tells you which models your key can use and what each one is:

curl https://bothub-api.bookab.info/v1/models \
  -H "Authorization: Bearer bhk_live_xxxxxxxx"
{
  "object": "list",
  "data": [
    {
      "id": "gpt-5.4",
      "object": "model",
      "owned_by": "bothub",
      "kind": "chat",
      "endpoints": ["/v1/chat/completions", "/v1/responses"]
    },
    {
      "id": "gpt-image-2.5",
      "object": "model",
      "owned_by": "bothub",
      "kind": "image_generation",
      "endpoints": ["/v1/images/generations"]
    }
  ]
}

kind and endpoints are BotHub extensions (OpenAI SDKs ignore unknown fields): kind tells you whether it is a chat, image, video or embedding model, and endpoints tells you exactly where to send the request.

The list only contains models your key is allowed to use. If the model you want is missing, check the key's scopes first.

What you can do

CapabilityEndpointNotes
ChatPOST /v1/chat/completionsOpenAI Chat Completions — streaming, tool calls, vision
Chat (new protocol)POST /v1/responsesOpenAI Responses API
EmbeddingsPOST /v1/embeddingsText embeddings
ImagesPOST /v1/images/generationsReturns the image synchronously
VideoPOST /v1/videosAsynchronous task
Image edit / video extendPOST /v1/tasksNative async task API

Not available yet: speech synthesis (/v1/audio/speech returns not_implemented); reranking has no public endpoint.

Handing the base URL and key to an AI

If you want an AI assistant (Claude, Codex, some agent client) to call the API for you, this is all it needs:

The BotHub API is OpenAI-compatible.
Base URL: https://bothub-api.bookab.info/v1
API Key: bhk_live_xxxxxxxx

Start with GET /v1/models to see what is available — each entry's `kind` and
`endpoints` tell you what it is and where to send requests. For images use
POST /v1/images/generations; it returns data[0].b64_json synchronously.
Full docs: https://bothub.bookab.info/en/api/overview
Errors come back in OpenAI's shape, and every 4xx carries a detail field spelling out what to do next (which scope is missing, which task to poll, which parameter is wrong). An AI that reads it can usually correct itself.

Getting an API key

Create one yourself inside the BotHub app — all three platforms have it:

PlatformPath
DesktopSettings → Model Services → BotHub Built-in AI → External Access
AndroidSettings → Model Services → BotHub Built-in AI → External Access
iOSSettings → BotHub Built-in AI → External Access

That screen copies the base URL, creates and revokes keys, and shows each key's request count and spend over the last 7 days.

Keys look like bhk_live_xxxxxxxx_yyyyyyyy and are shown only once, right after creation — close the dialog and it is gone for good, so copy it there and then. A key spends your account balance: never commit one to a repository or ship one in frontend code. If one leaks, revoke it from the same screen.

New keys carry every scope by default (chat, images, video, embeddings), so they work right away.

Next