Skip to main content

orquesta

tests

A single-file, zero-dependency command-line router for large language model APIs. It sends a prompt to one or many providers, falls back automatically when a provider is down, out of credit or misconfigured, and keeps a local log of call metadata so you can see what each provider costs and how reliable it is.

Versión en español más abajo.

Why

Working with several model providers at once has three recurring problems:

  1. A provider fails and the task stalls. Keys expire, balances run out, endpoints time out, models get renamed.
  2. Errors are opaque. HTTP 402, 401, 429 or an empty answer from a reasoning model do not tell you what to do next.
  3. Cost and reliability are guesswork. Without measurement, the fallback order is chosen by reputation, not by data.

orquesta addresses each one: role-based fallback chains, error diagnosis that names the concrete action and the console where to take it, and a local metadata log that feeds --costs and a circuit breaker.

Features

  • 11 providers behind one interface: Anthropic, OpenAI, Google Gemini (API key or Vertex AI), DeepSeek, Moonshot Kimi, Z.ai GLM, xAI Grok, Mistral, Perplexity Sonar, Groq, and the Codex CLI.
  • Roles with fallback chains (revision, resumen, extraccion, contexto, documento, hechos, alterno, rapido): providers are tried in order until one answers. If you also pass --provider, only those providers are used; if none belongs to the role, nothing is sent.
  • Circuit breaker: a provider whose last 3 calls in the past hour failed moves to the end of the chain.
  • Hedged requests (--cobertura SEG): if the first provider has not answered in N seconds, the second starts in parallel and the first valid answer wins. This can cost two calls.
  • Effort levels (--esfuerzo bajo|medio|alto|max) pick each vendor's model tier and reasoning level.
  • Parallel fan-out (--provider a,b,c): answers print as they arrive.
  • Batch mode (--batch "docs/**/*.txt"): one instruction over many files, spread across providers; one failing file does not stop the batch.
  • Reasoning-model safeguards: reasoning models can spend the whole output budget thinking and return nothing. orquesta raises the output ceiling to a per-provider minimum (up to 32,000 tokens) and retries once with a larger ceiling (up to 64,000) when an answer comes back empty or truncated. The ceiling is not what you pay; you pay for tokens generated. There is no aggregate spending cap.
  • Actionable diagnostics (in Spanish): out of credit, invalid key, missing payment method, rate limit, unknown model, insufficient budget, each with the provider's console link.
  • Cost report (--costs --dias 30): calls, tokens, mean latency and estimated USD per provider. Prices are estimates hard-coded in the script; verify them with each provider.
  • Optional personal-data warning (--guardia or ORQUESTA_GUARDIA=1): flags Colombian ID numbers, emails and mobile numbers in the prompt before sending. It only warns; it does not block, anonymize, or inspect PDFs and images.

Security and privacy

  • Keys are read only from the variables orquesta uses, from the environment or a local .env (and, on Windows, from user environment variables). They are not printed or written to the log.
  • Error messages pass through a redactor that removes the values of those keys, including URL-encoded variants.
  • Requests that carry credentials refuse redirects to another host or from HTTPS to HTTP.
  • The log (orquesta_log.jsonl) stores provider, model, role, tokens, latency, outcome and an error class. Of the prompt it stores a truncated SHA-256 hash and its length. A hash is not anonymization: a short, guessable prompt can be matched.
  • With Gemini on Vertex AI, a short-lived OAuth token is cached in your user cache folder (%LOCALAPPDATA%\orquesta or ~/.cache/orquesta), never in the repository. Set ORQUESTA_SIN_CACHE_TOKEN=1 to disable it.
  • Codex CLI runs read-only in an empty temporary folder and does not receive the other providers' keys. Read-only means it cannot write; it may still read files on your machine if the content you send asks it to. Do not use it with sensitive material.
  • Batch results (--out) contain full answers and file paths. Treat them as sensitive.

Install

Python 3.10 or newer. No packages are required. If the anthropic package is installed, it is used for Anthropic calls, pinned to https://api.anthropic.com.

pipx install orquesta-llm      # or: pip install orquesta-llm
orquesta --list

Or run it straight from the repository:

git clone https://github.com/smarroquinc10/orquesta.git
cd orquesta
cp .env.example .env   # fill in only the providers you use
python orquesta.py --list

orquesta never reads a .env from the folder you run it in. It reads, in order: the file named by ORQUESTA_ENV_FILE, a .env next to orquesta.py, or orquesta/.env in your user data folder (%LOCALAPPDATA% on Windows, ~/.local/state elsewhere). Variables already set in the environment always win.

Gemini works either with GEMINI_API_KEY alone, or through Vertex AI with GEMINI_PROJECT_ID and gcloud auth application-default login. GEMINI_AUTH=apikey|adc forces one of them.

If you use Claude Code with a subscription, keep ANTHROPIC_API_KEY in orquesta's .env rather than in your global environment: Claude Code bills per token when that global variable is set.

Usage

# A role with automatic fallback
python orquesta.py --role revision --prompt "Review this function" --file src/main.py --max-tokens 30000

# Several providers in parallel, to compare answers
python orquesta.py --provider deepseek,glm,mistral --prompt "Explain this error" --file log.txt

# Same instruction over many files
python orquesta.py --batch "docs/**/*.txt" --provider deepseek,kimi --prompt "Summarize in 5 lines" --out results.json

# Health and cost (--doctor makes a real, small call to every configured provider)
python orquesta.py --doctor
python orquesta.py --costs --dias 30

Other variables: ORQUESTA_MODEL_<PROVIDER> overrides a provider's default model; ORQUESTA_LOG_FILE moves the log; ORQUESTA_ROL_<ROLE>=a,b,c replaces a role's fallback order (for example ORQUESTA_ROL_RAPIDO=groq,deepseek). The default orders reflect one user's experience of cost and fit, not a ranking of vendors; adjust them to your accounts.

Model names and prices in PROVIDERS, MODELO_POR_ROL and PRECIOS reflect what was available when this was written. Providers rename models often: list them with --catalogos and adjust.

Tests

python -m unittest discover -s tests -v

The tests run offline and need no API keys: key redaction, redirect blocking, executable lookup, error diagnosis, personal-data detection, .env filtering and role handling. CI runs them on Linux, Windows and macOS.

Status

New project, extracted from a personal toolkit. The code and messages are in Spanish; contributions to translate, broaden the tests or generalize are welcome.

License

MIT.


En español

orquesta es un enrutador de línea de órdenes, de un solo archivo y sin dependencias, para las API de modelos de lenguaje. Envía una consulta a uno o varios proveedores y pasa solo al siguiente cuando uno está caído, sin saldo o mal configurado. Además registra metadatos de cada llamada, sin su contenido.

Lo esencial:

  • Roles con cadena de respaldo: un proveedor caído no deja la tarea varada.
  • Diagnóstico accionable: traduce cada error en la acción concreta y el enlace a la consola donde hacerla.
  • Control de gasto estimado: --costs muestra llamadas, tokens, latencia media y costo estimado por proveedor.
  • Procesamiento por lotes en paralelo, repartido entre proveedores.
  • Aviso opcional de datos personales colombianos (cédulas, correos, celulares) antes de enviar. Solo avisa; no anonimiza.
  • Las claves no se imprimen ni se registran. Del texto enviado solo se guarda un hash truncado y su longitud.

Requiere Python 3.10 o superior. Licencia MIT.

Metadata

Release files for orquesta-llm 0.1.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 orquesta-llm 0.1.0
File Size Uploaded Provenance Actions
orquesta_llm-0.1.0.tar.gz 38.3 kB With provenance Details for orquesta_llm-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orquesta-llm 0.1.0
File Interpreter ABI Platform Actions
orquesta_llm-0.1.0-py3-none-any.whl Python 3 none any Details for orquesta_llm-0.1.0-py3-none-any.whl

Total release size: 70.8 kB

Release files / orquesta_llm-0.1.0.tar.gz

Download URL orquesta_llm-0.1.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c64fcb89a6bb108210cf438af587b317cd78123919a17a4e68d5328fa2f0b53b
BLAKE2b-256 checksum
How to use checksums
55b5cd063810d64a4f83ca0f62ae40dc6a79ed9c94b132daf813fc74e6c23e59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Release files / orquesta_llm-0.1.0-py3-none-any.whl

Download URL orquesta_llm-0.1.0-py3-none-any.whl
Size 32.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d1ccf1715996ba7dc58b6b6c650d35a95453e28f8bf33eb10847d4c9cc46982
BLAKE2b-256 checksum
How to use checksums
955773e746daf8938084856250c2232d16945263ac27550b05b34a1ae14f5f9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Security for orquesta-llm 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for orquesta_llm-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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