Skip to main content

Official Python SDK for the Cerul video search API

Project description

cerul

The video search layer for AI agents — Python SDK.

Teach your AI agents to see. Search what was said, shown, or presented in any video.

Docs · Website · Main Repo · CLI

PyPI Downloads License Python


What is Cerul?

Cerul indexes tech talks, podcasts, conference presentations, and earnings calls. This SDK lets you search across all of them by meaning — speech, visuals, slides, and on-screen text.

from cerul import Cerul

client = Cerul()
result = client.search(query="Sam Altman on AGI timeline")

for r in result:
    print(f"{r.title}{r.url}")

Get your free API key at cerul.ai/dashboard — 1,000 credits/month, no credit card.

Install

pip install cerul

Quick Start

from cerul import Cerul

client = Cerul()  # reads CERUL_API_KEY from env

# Search videos
result = client.search(
    query="how does attention mechanism work",
    max_results=5,
    include_answer=True,
)

# Iterate directly over results
for r in result:
    print(f"[{r.score:.0%}] {r.title}")
    print(f"  {r.snippet}")
    print(f"  {r.url}")
    print()

# AI-generated answer (when include_answer=True)
if result.answer:
    print(f"Answer: {result.answer}")

# Access results by index
top = result[0]
print(f"Top result: {top.title} ({top.speaker})")

# Result count
print(f"Found {len(result)} results")

Search with Filters

result = client.search(
    query="Jensen Huang on AI infrastructure",
    max_results=10,
    ranking_mode="rerank",          # LLM-based reranking for higher precision
    include_answer=True,            # costs 2 credits instead of 1
    filters={
        "speaker": "Jensen Huang",
        "published_after": "2024-01-01",
        "source": "youtube",
    },
)

Response Format

All responses print as clean JSON:

print(result[0])
{
  "id": "unit_hmtuvNfytjM_1223",
  "score": 0.93,
  "url": "https://cerul.ai/v/a8f3k2x",
  "title": "Sam Altman on AGI Timeline",
  "snippet": "AGI is coming sooner than most people expect...",
  "transcript": "AGI is coming sooner than most people expect. I think we're within a few years...",
  "duration": 7200,
  "source": "youtube",
  "speaker": "Sam Altman",
  "timestamp_start": 1223.0,
  "timestamp_end": 1345.0
}

Convert to dict or JSON string:

data = result.to_dict()       # plain dict
json_str = result.to_json()   # JSON string

Async

from cerul import AsyncCerul

async with AsyncCerul() as client:
    result = await client.search(query="attention mechanism explained")
    for r in result:
        print(r.title)

Configuration

client = Cerul(
    api_key="cerul_sk_...",     # or reads CERUL_API_KEY env var
    timeout=30.0,               # seconds, default 30
    retry=True,                 # retry on 429/5xx/network errors, default False
)

Usage Monitoring

usage = client.usage()
print(f"Credits: {usage.credits_used} used / {usage.credits_remaining} remaining")
print(f"Daily free: {usage.daily_free_remaining} / {usage.daily_free_limit}")

Error Handling

from cerul import Cerul, CerulError

try:
    client = Cerul()
    result = client.search(query="test")
except CerulError as e:
    print(e.status_code)   # HTTP status (0 for network/timeout)
    print(e.code)          # "unauthorized", "rate_limited", "api_error", etc.
    print(e.message)       # human-readable message
    print(e.request_id)    # for debugging with Cerul support

Features

Feature Details
Sync + Async Cerul for synchronous, AsyncCerul for async/await
Typed responses Dataclass results with full type hints, no pydantic needed
JSON output print(result) gives formatted JSON, result.to_dict() for dicts
Iterable results for r in result, result[0], len(result)
Retry with backoff 429 reads Retry-After (capped at 60s), 5xx exponential backoff
Network error retry Timeouts and connection errors also retried when retry=True
Minimal deps Only httpx — no heavy frameworks

Ecosystem

Package Install Description
cerul (Python) pip install cerul This package
cerul (TypeScript) npm install cerul TypeScript SDK
cerul-cli curl -fsSL .../install.sh | bash CLI tool (Rust)
cerul Main repo — API, docs, skills, remote MCP

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cerul-0.0.4.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cerul-0.0.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file cerul-0.0.4.tar.gz.

File metadata

  • Download URL: cerul-0.0.4.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cerul-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c69b92472c4c117e68e114e0931715e7434cf7554c3ee766e7a6ce0a473c4718
MD5 414599ff3d69da9e85fb196228185ddc
BLAKE2b-256 9c5cdf3a2d31ae2bb9da547138fad7569d1afc410de9879272e399051d0db7cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for cerul-0.0.4.tar.gz:

Publisher: publish.yml on cerul-ai/cerul-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cerul-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cerul-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cerul-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b84fec35586a0dc021cf7d74760d5d58a72fa4da226a87973c8e9c164681699
MD5 47808f3ba3ed7268c40e26b90e03ec05
BLAKE2b-256 6fac068087423ace524dc128c3b87e53d6c160fc0281b0d0da2b541182bcf0cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for cerul-0.0.4-py3-none-any.whl:

Publisher: publish.yml on cerul-ai/cerul-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page