AI API: one API for AI models
What is AI API?
The AI API is an OpenAI-compatible gateway. Point your existing client at the Badgr base URL, send a request and get a response, with retries and fallback routing handled for you.
- Chat completions, including streaming
- Embeddings
- Any OpenAI-compatible SDK or tool by changing the base URL and key
Make your first request
curl https://aibadgr.com/v1/chat/completions \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"badgr-auto","messages":[{"role":"user","content":"Say hello"}]}'Get an API key at aibadgr.com/get-api-key and export it as BADGR_API_KEY.
What happens
- 1.Your request reaches the gateway with your API key.
- 2.Badgr picks a model route for the model you named.
- 3.If that route fails, Badgr retries and falls back to another route.
- 4.The response comes back in the OpenAI response format, and the request is tracked.
Cost control
- See Pricing for per-model rates before sending production traffic.
- Use a separate API key per project so you can tell usage apart.
Get results
- The response body is OpenAI-compatible, so existing parsers keep working.
- Request tracking is described in the API reference. Receipt coverage varies by endpoint, so check the reference before relying on a receipt for a specific one.