API documentation
The BubbaBuilt API is OpenAI-compatible. Point any OpenAI SDK at https://api.myai.example.com/v1 and use your API key.
Authentication
Every request needs a bearer token. Create keys in your dashboard — the full key is shown once at creation and only a hash is stored.
Authorization: Bearer sk_live_...
Models
GET https://api.myai.example.com/v1/models lists the models your key can use.
| Model | Context | Input / 1K | Output / 1K |
|---|---|---|---|
| No public models published yet. | |||
Chat completions
POST https://api.myai.example.com/v1/chat/completions
curl https://api.myai.example.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "myai-large",
"messages": [{"role": "user", "content": "Hello!"}],
"temperature": 0.7,
"max_tokens": 512
}'
const res = await fetch("https://api.myai.example.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MYAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "myai-large",
messages: [{ role: "user", content: "Hello!" }],
}),
});
const data = await res.json();
console.log(data.choices[0].message.content);
from openai import OpenAI
client = OpenAI(api_key=os.environ["MYAI_API_KEY"], base_url="https://api.myai.example.com/v1")
completion = client.chat.completions.create(
model="myai-large",
messages=[{"role": "user", "content": "Hello!"}],
)
print(completion.choices[0].message.content)
Streaming
Set "stream": true to receive server-sent events. Usage is accounted after the stream completes, including when a client disconnects early.
curl https://api.myai.example.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"myai-large","messages":[{"role":"user","content":"Hi"}],"stream":true}'
# Server-sent events:
# data: {"choices":[{"delta":{"content":"He"}}]}
# data: {"choices":[{"delta":{"content":"llo"}}]}
# data: [DONE]
Errors
Errors use the OpenAI error shape and never expose internal infrastructure.
{
"error": {
"message": "Rate limit exceeded for your plan.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}
| 401 | Missing or invalid API key |
| 403 | Suspended account, inactive subscription or insufficient credits |
| 404 | Unknown model |
| 408 / 504 | Inference request timed out |
| 413 | Request body too large |
| 429 | Rate limit exceeded |
| 500 / 502 | Unexpected error or upstream failure |
| 503 | Inference service temporarily unavailable |
Rate limits
Limits are enforced per organization based on your plan. A throttled response returns 429 with Retry-After and X-RateLimit-* headers.
Usage and token accounting
Every request records the model, endpoint, input/output tokens, duration and status. When the backend reports token counts we use them; otherwise usage is estimated and clearly marked as an estimate in your dashboard. Prompts and responses are not stored by default.