From f7dde68e9eae3142f2e3d4fc2c9aee185ffe060b Mon Sep 17 00:00:00 2001 From: michaelmanley <55236695+michaelbrinkworth@users.noreply.github.com> Date: Wed, 10 Dec 2025 09:28:40 +1000 Subject: [PATCH] docs: add AI Badgr as OpenAI-compatible backend (base_url override + examples) --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 5dceac7..ecceb69 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,36 @@ $ cd Rebel-OpenAI $ npm install $ node index.js ``` + +### Using AI Badgr (OpenAI-Compatible Backend) + +If you're already using the OpenAI API, you can also point your client at **AI Badgr**, which implements the same API surface (chat completions, streaming, JSON mode). + +AI Badgr uses optimized open-source models to provide more affordable inference and also supports optional private/self-hosted modes for teams that need additional data control. + +```bash +export OPENAI_API_KEY=YOUR_API_KEY +export OPENAI_BASE_URL=https://aibadgr.com/api/v1 +``` + +**JavaScript/TypeScript:** +```javascript +import OpenAI from 'openai'; +const client = new OpenAI({ apiKey: 'YOUR_API_KEY', baseURL: 'https://aibadgr.com/api/v1' }); +const response = await client.chat.completions.create({ model: 'gpt-3.5-turbo', messages: [{ role: 'user', content: 'Hello!' }], max_tokens: 200 }); +console.log(response.choices[0].message.content); +``` + + +**cURL:** +```bash +curl https://aibadgr.com/api/v1/chat/completions \ + -H "Authorization: Bearer YOUR_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"model":"gpt-3.5-turbo","messages":[{"role":"user","content":"Hello!"}],"max_tokens":200}' +``` + +**Notes:** +- Streaming: `"stream": true` +- JSON mode: `"response_format": {"type": "json_object"}` +- Because AI Badgr follows the OpenAI API spec, most existing OpenAI client code works by only changing the `base_url`.