Open source by Santander AI Lab. A tiny, vendor-neutral LLM client library — one interface for OpenAI, DeepSeek, Alibaba Qwen, AWS Bedrock and Google Gemini (or bring your own AI backend).
Part of Santander AI Open Source — open source AI projects from Banco Santander (santander.com).
A tiny, vendor-neutral wrapper for any LLM backend. One small interface,
pluggable providers. Write your application against LLMClient once and switch
between OpenAI, DeepSeek, Alibaba Qwen, AWS Bedrock, Google Gemini, a local
server, or your own
internal backend — without touching your code.
- Canonical interface + thin SDK adapters. One contract (
LLMClient) with a small, modular adapter per official vendor SDK. The SDKs do the heavy lifting (retries, streaming, types); llm_bridge just normalises the calls. - Zero required dependencies. The core (
mock,callable) is pure standard library. Each vendor SDK is an optional extra you install on demand. - Bring your own backend. Wrap any function with the
callableprovider — the library never needs to know which backend you use. - One interface.
chat(messages)andcomplete(prompt)returning a normalisedLLMResponse(content + token usage + latency).
pip install llm-bridge # core only (no vendor SDKs)
pip install "llm-bridge[openai]" # + OpenAI SDK
pip install "llm-bridge[deepseek]" # + OpenAI SDK for DeepSeek
pip install "llm-bridge[qwen]" # + OpenAI SDK for Qwen/DashScope
pip install "llm-bridge[aws]" # + AWS Bedrock (boto3)
pip install "llm-bridge[google]" # + Google Gemini (google-genai)
pip install "llm-bridge[all]" # everythingfrom llm_bridge import create_llm
# Offline, no credentials — great for tests and demos.
llm = create_llm({"provider": "mock"})
print(llm.complete("Hello!").content)
# Switch provider by changing one dict — your code stays the same.
llm = create_llm({"provider": "openai", "model": "gpt-4o-mini"}) # needs [openai] + OPENAI_API_KEY
llm = create_llm({"provider": "deepseek", "model": "deepseek-v4-pro"}) # needs [deepseek] + DEEPSEEK_API_KEY
llm = create_llm({"provider": "qwen", "model": "qwen-plus"}) # needs [qwen] + DASHSCOPE_API_KEY
llm = create_llm({"provider": "bedrock", "model": "<bedrock-model-id>"}) # needs [aws] + AWS creds
llm = create_llm({"provider": "google", "model": "gemini-2.5-flash"}) # needs [google] + GOOGLE_API_KEY
resp = llm.chat([
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "Name three primary colors."},
])
print(resp.content, resp.total_tokens)The callable provider wraps any function — the recommended way to plug in a
proprietary or internal backend:
from llm_bridge import create_llm
def my_backend(messages, temperature=0.7, max_tokens=1024, **kwargs):
# call your own SDK / gateway / local model here, return the text
return "the model output"
llm = create_llm({"provider": "callable", "callable": my_backend})
print(llm.complete("Hi").content)| Provider | Name(s) | Dependency |
|---|---|---|
| Mock (offline) | mock |
none |
| Bring your own | callable |
none |
| OpenAI (and OpenAI-compatible) | openai |
[openai] |
| DeepSeek | deepseek |
[deepseek] |
| Alibaba Qwen | qwen |
[qwen] |
| AWS Bedrock (Converse) | bedrock, aws |
[aws] |
| Google Gemini | google, gemini |
[google] |
Credentials are read from environment variables (OPENAI_API_KEY,
DEEPSEEK_API_KEY, DASHSCOPE_API_KEY, GOOGLE_API_KEY/GEMINI_API_KEY,
standard AWS credential chain). Never
hardcode secrets.
The openai provider also targets any OpenAI-compatible endpoint (vLLM,
Ollama, Azure OpenAI, or an internal gateway): pass a base_url (or set
OPENAI_BASE_URL). For local servers without auth, set a dummy OPENAI_API_KEY.
The deepseek provider uses DeepSeek's OpenAI-compatible API via the OpenAI
SDK, defaults to https://api.deepseek.com, and accepts base_url or
DEEPSEEK_BASE_URL for compatible endpoints.
The qwen provider uses Alibaba Model Studio/DashScope's OpenAI-compatible API
via the OpenAI SDK. It defaults to
https://dashscope-intl.aliyuncs.com/compatible-mode/v1 and accepts base_url
or DASHSCOPE_BASE_URL for other regions or workspaces.
class LLMClient:
@property
def model(self) -> str: ...
@property
def provider(self) -> str: ...
def chat(self, messages, *, temperature=0.7, max_tokens=1024, **kwargs) -> LLMResponse: ...
def complete(self, prompt, *, system=None, temperature=0.7, max_tokens=1024, **kwargs) -> LLMResponse: ...
@dataclass
class LLMResponse:
content: str
model: str
prompt_tokens: int
completion_tokens: int
finish_reason: str
latency_ms: float
raw: Any # the provider's raw response
# .total_tokensImplement LLMClient, expose build(config) -> LLMClient, and register it in
llm_bridge.registry. See CONTRIBUTING.md.
See examples/: mock_example.py, callable_example.py,
openai_example.py, deepseek_example.py, bedrock_example.py,
qwen_example.py, bedrock_example.py, google_example.py.
- Python 3.9+
- No required runtime dependencies for the core (
mock,callable). - Optional vendor SDKs are installed on demand via extras (
[openai],[deepseek],[qwen],[aws],[google],[all]).
Contributions are welcome! Please read CONTRIBUTING.md and
our CODE_OF_CONDUCT.md. External contributors will be
asked to sign the CLA (handled automatically by the CLA Assistant bot).
Please report vulnerabilities privately — see SECURITY.md. Do
not open a public issue for security reports.
If you use this software, please cite it using the metadata in
CITATION.cff.
This software is an open source project from the Santander AI Lab, provided "as is" under its license, without warranties or conditions of any kind. It is not an official Banco Santander product or service, carries no commitment of production support, and does not constitute financial, legal or professional advice.
"Santander" and its logo are registered trademarks of Banco Santander, S.A. The project license does not grant any right to use them beyond factual attribution.
If you believe you have found a security vulnerability, follow our security policy — do not open a public issue. You are responsible for assessing the suitability of this software for your use case and for keeping your own deployments up to date.