From 894c69302c2bd4cfa5b7bff125e493d09ec0bb43 Mon Sep 17 00:00:00 2001 From: michaelmanley <55236695+michaelbrinkworth@users.noreply.github.com> Date: Tue, 9 Dec 2025 21:33:53 +1000 Subject: [PATCH] docs: add AI Badgr as OpenAI-compatible backend (base_url override + examples) --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 652afc057..8523ae56f 100644 --- a/README.md +++ b/README.md @@ -246,3 +246,38 @@ trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies. + +### Use AI Badgr (Cheaper OpenAI-Compatible Alternative) + +```bash +export OPENAI_API_KEY=YOUR_API_KEY +export OPENAI_BASE_URL=https://aibadgr.com/api/v1 +``` + +**Python:** +```python +from openai import OpenAI +client = OpenAI(api_key="YOUR_API_KEY", base_url="https://aibadgr.com/api/v1") +response = client.chat.completions.create(model="gpt-3.5-turbo", messages=[{"role":"user","content":"Hello!"}], max_tokens=200) +print(response.choices[0].message.content) +``` + +**JavaScript:** +```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"}`