More accurate AI than any single model. The open protocol for AI model ensembles.
Project description
url4
More accurate AI than any single model. The open protocol for AI model ensembles.
Install
pip install url4
Quick Start
import asyncio
from url4 import Council
async def main():
council = Council("claude-haiku|gpt-4o-mini")
result = await council.ask("What causes auroras?")
print(result.response)
asyncio.run(main())
What It Does
url4 queries multiple AI models in parallel and synthesizes their responses into a single, more accurate answer. Like an ensemble in machine learning — but for LLMs.
# Weighted ensemble with custom synthesis instruction
council = Council("0.5*claude-opus|0.3*gpt-4o|0.2*gemini-pro!synthesize the most accurate answer")
result = await council.ask("What is dark matter?")
# Streaming output
async for chunk in council.ask_stream("Explain quantum computing"):
print(chunk, end="", flush=True)
# Cost estimation before running
estimate = council.estimate("any prompt")
print(f"Estimated cost: ${estimate.total_cost:.4f}")
Features
- Multi-model ensembles — query any combination of Claude, GPT, Gemini, Llama, Mistral, DeepSeek
- Weighted synthesis — control how much each model contributes
- Streaming — stream the synthesis output token by token
- Caching — responses are cached locally so repeated queries are free
- Nested councils — councils of councils for multi-level synthesis
- Progressive reduce — synthesize at checkpoints as models respond
- Cost estimation — estimate costs before executing
- CLI —
url4 ask "claude|gpt-4o" "your question" - Eval harness — benchmark councils against HLE and other datasets
CLI
url4 ask "claude-haiku|gpt-4o-mini" "What is 2+2?"
url4 estimate "claude-opus|gpt-4o" "anything"
url4 models
url4 cache-stats
API Keys
Set the API keys for the providers you want to use:
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
export OPENROUTER_API_KEY=sk-or-... # optional: routes to 200+ models
If you have Claude Code installed, url4 can use it as a zero-config fallback — no API keys needed.
The Protocol
url4 is a URL-based grammar for composing AI queries:
claude-haiku|gpt-4o!What is the meaning of life?
Sources left of !, prompt right of !. Pipe | separates sources. Weights with *, nesting with []:
0.5*claude-opus|0.3*[gpt-4o|gemini!draft]|0.2*deepseek!final synthesis
Full spec: url4.ai/spec.html
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file url4-0.1.tar.gz.
File metadata
- Download URL: url4-0.1.tar.gz
- Upload date:
- Size: 48.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d1bf05e6567d5ec2eb34400282527a9d1a6d46752d59560a62d26e0e3f5642e
|
|
| MD5 |
a9a910e27ea97d3bd6b8b1a4562c738e
|
|
| BLAKE2b-256 |
3edbe3119ecdc21a3e65d051ab4f13c254bbc3213684a4db8e4b093cea2424f3
|
File details
Details for the file url4-0.1-py3-none-any.whl.
File metadata
- Download URL: url4-0.1-py3-none-any.whl
- Upload date:
- Size: 61.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45a621e8add29a908deebbbac71ef85f1b764583e86157f222639c643837e115
|
|
| MD5 |
60ad681e1524b4465e63f6a2e58b59eb
|
|
| BLAKE2b-256 |
2f6acfb5f96f5c5d706e77551a6736f407227c4fcbc2fb1e068c147bf37c1f96
|