st-orcarouter
A Streamlit connection for OrcaRouter — an OpenAI-compatible LLM gateway with adaptive routing across 150+ models behind a single API key.
st-orcarouter plugs OrcaRouter into Streamlit's st.connection mechanism, so you get cached completions, token-by-token streaming for st.write_stream, and a model list for st.selectbox without writing the client wiring yourself.
I'm an engineer on the OrcaRouter team.
Install
pip install st-orcarouter
Quickstart
-
Get an API key at https://www.orcarouter.ai/console.
-
Add it to
.streamlit/secrets.toml:[connections.orcarouter] api_key = "sk-orca-xxxx"
-
Use it in your app:
import streamlit as st from st_orcarouter import OrcaRouterConnection conn = st.connection("orcarouter", type=OrcaRouterConnection) # One-shot, cached completion st.write(conn.chat("Tell me a joke", ttl=3600)) # Streaming straight into the chat UI st.write_stream(conn.stream("Write a short story")) # Populate a model picker with the models your key can use model = st.selectbox("Model", conn.list_models())
-
Run it:
streamlit run your_app.py
A complete chatbot is in examples/streamlit_app.py.
API
st.connection("name", type=OrcaRouterConnection) returns an OrcaRouterConnection with:
| Member | Description |
|---|---|
chat(messages, *, model="orcarouter/auto", ttl=None, **params) -> str |
Non-streaming completion, cached with st.cache_data. messages may be a prompt string or a list of chat messages. |
stream(messages, *, model="orcarouter/auto", **params) -> Iterator[str] |
Streaming completion that yields content deltas; pass it to st.write_stream. |
list_models(*, ttl=3600, chat_only=True) -> list[str] |
Model ids your key can use (via GET /v1/models), cached. chat_only filters out image / audio / embedding models. |
client |
The underlying authenticated openai.OpenAI client for anything not wrapped here (embeddings, tool calls, etc.). |
Extra keyword arguments (temperature, reasoning_effort, extra_body, ...) are forwarded to the OpenAI chat-completions call unchanged.
Models and routing
orcarouter/autois OrcaRouter's adaptive router — it picks an upstream per request based on your console routing strategy. See https://www.orcarouter.ai/console/routing.- Use fully qualified ids for a specific model, e.g.
openai/gpt-5,anthropic/claude-opus-4.7. - Browse the full catalog at https://www.orcarouter.ai/models.
Configuration
The API key is resolved in this order:
st.connection(..., api_key="sk-orca-...")- the
[connections.<name>]section of.streamlit/secrets.toml - the
ORCAROUTER_API_KEYenvironment variable
You can override the base URL with base_url= or a base_url secret (defaults to https://api.orcarouter.ai/v1).
Development
pip install -e ".[dev]"
pytest # offline unit tests, no API key needed
python scripts/orcarouter-live-test.py # live end-to-end check (needs a real key)
License
Apache-2.0.
Metadata
Release files for st-orcarouter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| st_orcarouter-0.1.0.tar.gz | 12.8 kB | Without provenance | Details for st_orcarouter-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| st_orcarouter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for st_orcarouter-0.1.0-py3-none-any.whl |
Total release size: 23.4 kB
Release files / st_orcarouter-0.1.0.tar.gz
| Download URL | st_orcarouter-0.1.0.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1dff859b665f7c2eb9a1548116fcda9cf20d19935e5528d43d8a9d486bf58f4
|
|
BLAKE2b-256 checksum How to use checksums |
b8d37c5e4147c1b326627472a8004d80d643b5fb7299b50e2c934f7ae578f379
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / st_orcarouter-0.1.0-py3-none-any.whl
| Download URL | st_orcarouter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7d5367b7c4e26da4f4c63400bea6085abeec2782a4eff1d6971c82524d11cc9
|
|
BLAKE2b-256 checksum How to use checksums |
b254a9b336651d25ab94dea557aaf74185b4f12d2d239531685fa0083ecbd1a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for st-orcarouter 0.1.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.