Skip to main content

subllm

subllm is the single Python source of truth for Subactor LLM providers, models, application/function routes and their priorities. The repository name and import package are subllm; the distribution is named subactor-subllm because the unscoped subllm distribution name is already in use.

The repository never tracks credentials. For local development, all SubLLM consumers in one sibling-project workspace can read provider keys from the single ignored subllm/.env file. In CI and deployments, process environment variables or a credential vault remain the source and override that file.

Policy

LLM strategies are assigned by API-key source (ADOPT wellmanifest/policy-dsl profile llm-credential and wellmanifest/env-dsl subllm-credential-strategies.env):

Credential Provider Transport Default model
CURSOR_API_KEY cursor Cursor SDK gpt-5.6-sol
ZAI_API_KEY zai OpenAI-compatible glm-5.2
OPENROUTER_API_KEY openrouter OpenAI-compatible glm-5.2

gpt-5.6-sol is Cursor-only. OpenRouter never claims Sol as openai/gpt-5.6-sol. Missing keys fail closed for that strategy; routes then continue with later candidates.

Koru is intentionally stricter than the shared default route. Its planning-assistant and queue-executor routes allow only Cursor grok-4.6 with effort=xhigh and fast=false; they do not fall back to OpenRouter, Z.AI, Sol, or a different Cursor preset.

Gemini 3.1 Pro Preview is blocked in the catalog. Provider, model, application and route definitions live in src/subllm/policy.py. See docs/credential-strategies.md.

The two Validator routes are intentionally narrower than the shared provider default: validator-agent/patch-review and validator-agent/direct-pr-review pin direct Z.AI to glm-5.3, while their OpenRouter fallback remains z-ai/glm-5.2. This keeps the GLM 5.3 rollout bounded to Validator until the newer model is qualified for other consumers.

Application identity in provider logs

Every application has one stable ID plus an operator-controlled display name and public attribution URL in subllm.toml:

[applications.doctor-agent]
name = "doctor-agent"
url = "https://github.com/subactor/doctor-agent"

OpenRouter requests carry the URL in HTTP-Referer, the configured name in X-OpenRouter-Title, and the stable application ID in user. Z.AI requests carry the stable ID in user_id. Native HTTP and SubLLM-managed LiteLLM calls also carry a unique request_id prefixed with the application and function. These values contain no credential or end-user personal data.

ResolvedRoute.litellm_kwargs() adds the provider-specific fields for OpenAI-compatible transports. Cursor routes use cursor_sdk_kwargs() instead.

Provider priority and default models

Edit the tracked subllm.toml file:

[providers.cursor]
enabled = true
priority = 0
default_model = "gpt-5.6-sol"

[providers.zai]
enabled = true
priority = 10
default_model = "glm-5.2"

[providers.openrouter]
enabled = true
priority = 20
default_model = "glm-5.2"

Lower priority wins. Set enabled = false to remove a provider from every route. Sibling projects discover this file automatically. Set SUBLLM_POLICY_FILE for another layout.

Fallback chain

SUBLLM_PROVIDER_ORDER is a comma-separated allowlist: cursor, zai, openrouter. Empty or unset uses the default:

  • cursor,zai,openrouter when CURSOR_API_KEY is set,
  • zai,openrouter when it is absent.

Unknown names fail closed. resolve() returns cursor when that candidate wins and the Cursor key is valid.

One local credential file

cp .env.example .env
chmod 600 .env
ZAI_API_KEY=YOUR_API_KEY_ID.YOUR_SIGNATURE_SECRET
OPENROUTER_API_KEY=
CURSOR_API_KEY=
SUBLLM_PROVIDER_ORDER=

Python API

from subllm import resolve

route = resolve("repair-agent", "repair-plan")
# wellmanifest/webpage site UX judgment:
# route = resolve("platform", "site-audit")
if route.provider == "cursor":
    sdk = route.cursor_sdk_kwargs()
else:
    result = completion(**route.litellm_kwargs(), messages=[...])

CLI

subllm check
subllm providers
subllm resolve doctor-agent repair-proposal --configured
subllm resolve onedev-agent code-edit --provider openrouter --field litellm-model
subllm poa inspect poa://subactor.subllm/process/list-routes/v1
subllm serve --host 127.0.0.1 --port 8788

CLI, shell and HTTP share one POA CQRS/ES bus. See docs/poa-api.md.

Development

python -m venv .venv
. .venv/bin/activate
python -m pip install -e '.[test]'
./scripts/verify

See docs/architecture.md and docs/operations.md.

Metadata

Release files for subactor-subllm 1.4.2

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

Source distribution (sdist)

Source distribution for subactor-subllm 1.4.2
File Size Uploaded
subactor_subllm-1.4.2.tar.gz 37.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for subactor-subllm 1.4.2
File Interpreter ABI Platform
subactor_subllm-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 70.6 kB

Release files / subactor_subllm-1.4.2.tar.gz

Download URL subactor_subllm-1.4.2.tar.gz
Size 37.1 kB
Tags Source
SHA-256 checksum
How to use checksums
776b4dac1ea27b1de8721ac069be45ecb0357266a77e0e055a18aa8f1c319554
BLAKE2b-256 checksum
How to use checksums
61f42025c6e50440f60cab60089a09c11f25a3598f9afcf3e1df697818128599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / subactor_subllm-1.4.2-py3-none-any.whl

Download URL subactor_subllm-1.4.2-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ef26c9612a8d51d5c41a65d8ff2ab0e8fa6e8edae6ef68536786c1fdf66744a
BLAKE2b-256 checksum
How to use checksums
4f8403f91cd4312b60fd7f3dd69ed615acd121e289d8b799fd7f5bdd0ff43160
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.4.2 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

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