Skip to main content

keirolabs-api

Web search for AI agents, in one line. No dependencies.

pip install keirolabs-api
export KEIRO_API_KEY=keiro_...   # free key, 750 credits: https://keirolabs.cloud
from keirolabs import search

search("latest llama release")
# [{"title": ..., "url": ..., "snippet": ..., "content": ...}, ...]

Wrap your OpenAI or Anthropic client. The model searches when it needs to, and you get a normal response back.

from openai import OpenAI
from keirolabs import wrap

client = wrap(OpenAI())
client.chat.completions.create(
    model="gpt-4.1",
    messages=[{"role": "user", "content": "What did Nvidia report this quarter?"}],
)
from anthropic import Anthropic
client = wrap(Anthropic())

Any client with the OpenAI chat completions API should work, such as OpenRouter or Groq (tested on Groq). Your own tools keep working: if the model calls one of them, you get the response back as usual. The model gets up to 3 searches per call (max_steps). Sync clients only for now (OpenAI(), Anthropic(), not the async ones). Streaming calls (stream=True) go straight to the model without search.

Prompt-ready web context

Searches, reads the pages, and returns the passages most likely to answer the question, packed into your token budget.

from keirolabs import context

prompt = f"""Answer using these sources.

{context("who won the 2022 world cup", max_tokens=1500)}

Question: who won the 2022 world cup?"""

It runs on Keiro deep search, which scores 96.5% on SimpleQA.

Switching from Tavily

Change one import. The methods and response keys match Tavily's.

- from tavily import TavilyClient
+ from keirolabs.compat import TavilyClient

search, get_search_context, qna_search and extract are supported. Differences: score comes from the result's rank, domain filters are applied after the search (so you can get fewer results than you asked for), and images is always empty. A Tavily key is ignored: pass a Keiro key or set KEIRO_API_KEY.

Everything else

from keirolabs import search, deep, answer, md, tool, run_tool

search("query", mode="lite")      # cheapest: $0.10 per 1,000 on paid plans
search("query", mode="fast")      # fast live results
search("query", mode="content")   # full page markdown for each result
deep("query", budget=2000)        # ranked evidence + confidence
answer("query")                   # {"answer": ..., "sources": [...]}
md("https://example.com")         # any page as clean text

tool()               # web_search tool for OpenAI-style APIs
tool("anthropic")    # ...or Anthropic, "gemini", "json"
run_tool(args)       # run a model's web_search call, get the tool result text

Use a client object for a different key, base URL or timeout:

from keirolabs import Keiro
k = Keiro(api_key="keiro_...", timeout=60)
k.search("query")

Errors raise keirolabs.KeiroError with .status (401 bad key, 402 out of credits, 429 rate limited).

Results are lists of dicts. The full API response (credits used, latency) is on .raw.

Pricing

Free: 750 credits at signup. Lite costs 1 credit on free, and $0.10 per 1,000 searches on paid plans. Pricing.

MIT license.

Metadata

Release files for keirolabs-api 1.0.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 keirolabs-api 1.0.0
File Size Uploaded Provenance Actions
keirolabs_api-1.0.0.tar.gz 13.1 kB Without provenance Details for keirolabs_api-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for keirolabs-api 1.0.0
File Interpreter ABI Platform Actions
keirolabs_api-1.0.0-py3-none-any.whl Python 3 none any Details for keirolabs_api-1.0.0-py3-none-any.whl

Total release size: 24.2 kB

Release files / keirolabs_api-1.0.0.tar.gz

Download URL keirolabs_api-1.0.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2e866278350cc5aacf853b64e7ddcf7757fef980a5b529b5df9bfb7c8c82302a
BLAKE2b-256 checksum
How to use checksums
ae0ffe582c7bab75099b8dcdb1d50b072da6e1684f5fc687d24a0edbd67bc1c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / keirolabs_api-1.0.0-py3-none-any.whl

Download URL keirolabs_api-1.0.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23cbb9d72531d3e372dbda3d9f3eeed47a8a1a418c578d8947bf2922a914ef30
BLAKE2b-256 checksum
How to use checksums
65412691f61c14e98d08174c2a9b202fe6918d73b2b21b3f53dc0b0fd2188761
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for keirolabs-api 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No 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