Unified LLM API for Python — no gateway, no vendor SDKs.

Connect to multiple LLM providers through one lightweight, typed Python interface with just one core runtime dependency.

Try a chat request

Install

Use Python 3.10–3.14 and run this command in your virtual environment.

python -m pip install llm-api-adapter==0.11.0

Set OPENAI_API_KEY in your terminal environment.

Send a message

Save the example as chat.py and run python chat.py.

import os

from llm_api_adapter.models.messages.chat_message import UserMessage
from llm_api_adapter.universal_adapter import UniversalLLMAPIAdapter

adapter = UniversalLLMAPIAdapter(
    organization="openai",
    model="gpt-6.2-astra",
    api_key=os.environ["OPENAI_API_KEY"],
)

response = adapter.chat(
    messages=[UserMessage("Explain what an API is in one sentence.")],
    max_tokens=1024,
    timeout_s=60,
)
print(response.content)