Documentation
The API is OpenAI-compatible: any OpenAI SDK, LangChain, LlamaIndex or plain HTTP works by changing two lines — the base URL and the key. Billing is prepaid, per token, in INR.
Quickstart
- Create an account — trial credit included.
- Copy your API key from the console.
- Point your OpenAI client at
https://api.bookmyhost.com/v1.
pip install openai
from openai import OpenAI
client = OpenAI(
api_key="YOUR_KEY",
base_url="https://api.bookmyhost.com/v1",
)
r = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": "Namaste! What can you do?"}],
)
print(r.choices[0].message.content)
Authentication
Bearer token in the Authorization header. Keys are created and
rotated in the console; you can hold several (per app / environment) and see
spend per key.
Authorization: Bearer sk-…
Chat completions
curl https://api.bookmyhost.com/v1/chat/completions \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "llama-3.3-70b",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a haiku about the monsoon."}
],
"max_tokens": 256,
"temperature": 0.7
}'
Available chat models:
llama-3.3-70b, qwen3-coder-30b, qwen2.5-vl-7b-instruct, llama-3.1-8b, qwen3-8b — full list with live pricing on the models page.
Streaming
Standard SSE streaming. Add stream_options to receive token usage in the final chunk.
stream = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
Tool / function calling
OpenAI-style tools with tool_choice: "auto" is supported
on the chat models. Remember to send the tool result back as a
role: "tool" message to complete the round-trip.
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}}
}
}]
r = client.chat.completions.create(model="llama-3.3-70b",
messages=[{"role": "user", "content": "Weather in Mumbai?"}],
tools=tools, tool_choice="auto")
Embeddings
r = client.embeddings.create(
model="bge-m3",
input=["Namaste world", "नमस्ते दुनिया"],
)
print(len(r.data[0].embedding))
Embedding requests bill input tokens only.
Reasoning models
Some models think before answering; the reasoning arrives separately in
reasoning_content (or reasoning) and the answer in
content. Reasoning consumes output tokens — set
max_tokens generously or the answer may come back empty.
Billing & errors
- Prepaid INR credit; each request deducts (input tokens × input rate + output tokens × output rate) / 1M.
401— bad or revoked key.403— model not in your plan tier or IP not allowed.429— over your requests-per-minute limit; back off and retry.- Budget exceeded returns
400with anExceededBudgetmessage — top up in the console. - A request to a standby model waits a few seconds while it wakes; nothing fails.
