Skip to main content

LlamaIndex LLMs Integration: AI Badgr

AI Badgr (Budget/Utility, OpenAI-compatible)

Installation

To install the required packages, run:

pip install llama-index-llms-aibadgr

Setup

Initialize AI Badgr

You need to set either the environment variable AIBADGR_API_KEY or pass your API key directly in the class constructor. Replace <your-api-key> with your actual API key:

from llama_index.llms.aibadgr import AIBadgr
from llama_index.core.llms import ChatMessage

llm = AIBadgr(
    api_key="<your-api-key>",
    model="premium",
)

Generate Chat Responses

You can generate a chat response by sending a list of ChatMessage instances:

message = ChatMessage(role="user", content="Tell me a joke")
resp = llm.chat([message])
print(resp)

Streaming Responses

To stream responses, use the stream_chat method:

message = ChatMessage(role="user", content="Tell me a story in 250 words")
resp = llm.stream_chat([message])
for r in resp:
    print(r.delta, end="")

Complete with Prompt

You can also generate completions with a prompt using the complete method:

resp = llm.complete("Tell me a joke")
print(resp)

Streaming Completion

To stream completions, use the stream_complete method:

resp = llm.stream_complete("Tell me a story in 250 words")
for r in resp:
    print(r.delta, end="")

Model Configuration

AI Badgr supports tier-based model names for easy selection:

  • basic - Budget tier model (maps to phi-3-mini)
  • normal - Standard tier model (maps to mistral-7b)
  • premium - Premium tier model (maps to llama3-8b-instruct, recommended default)
# Using tier names (recommended)
llm = AIBadgr(model="premium", api_key="your_api_key")
resp = llm.complete("Write a story about a dragon who can code in Rust")
print(resp)

Advanced: Power-User Model Names

You can also use specific model names directly:

llm = AIBadgr(model="llama3-8b-instruct", api_key="your_api_key")
resp = llm.complete("Explain quantum computing")
print(resp)

OpenAI model names are accepted and mapped automatically.

Environment Variables

You can configure AI Badgr using environment variables:

export AIBADGR_API_KEY="your_api_key"
export AIBADGR_BASE_URL="https://aibadgr.com/api/v1"

Metadata

Release files for llama-index-llms-aibadgr 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-aibadgr 0.4.0
File Size Uploaded Provenance Actions
llama_index_llms_aibadgr-0.4.0.tar.gz 4.3 kB Without provenance Details for llama_index_llms_aibadgr-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-aibadgr 0.4.0
File Interpreter ABI Platform Actions
llama_index_llms_aibadgr-0.4.0-py3-none-any.whl Python 3 none any Details for llama_index_llms_aibadgr-0.4.0-py3-none-any.whl

Total release size: 8.3 kB

Release files / llama_index_llms_aibadgr-0.4.0.tar.gz

Download URL llama_index_llms_aibadgr-0.4.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0d6c55f6845ccf5348af6b2e875d73fa151cd279d75501e904bf6d8b977c179e
BLAKE2b-256 checksum
How to use checksums
adbd3c6ab6241284896280549372b999fcd5b138d5f6ad185e9204f1e1da5618
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_llms_aibadgr-0.4.0-py3-none-any.whl

Download URL llama_index_llms_aibadgr-0.4.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
533e097c83fea574205b3b444e2ec524cfc200d82ae2eedb9aab98702f46358f
BLAKE2b-256 checksum
How to use checksums
9e952eb0ff28faaa477f5c69d2a47671fc49b804d03c2febeb688ee4962f76d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-llms-aibadgr 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page