Skip to main content

cerid-sdk

Python client for the Cerid AI Knowledge Companion HTTP API.

pip install cerid-sdk

Sync and async clients with typed responses. Resource groups for the knowledge base, hallucination verification, semantic memory, smart-routed LLM completion, and system endpoints. Built against the stable /sdk/v1/ surface; drift between the server's routes and the published spec is caught in CI by scripts/gen_sdk_openapi.py --check.

Quickstart

client_id is required — it is the X-Client-ID header the server uses for per-client rate limiting and domain scoping.

from cerid import CeridClient
from cerid.models import MemoryExtractAcceptedResponse

client = CeridClient(base_url="http://localhost:8888", client_id="my-app")

# Search the knowledge base. Results are plain dicts — the server's metadata
# keys vary by source, so they are not flattened into attributes.
answer = client.kb.query("what did I read about graph databases last week?", top_k=5)
print(answer.context)
for hit in answer.results:
    print(hit["content"], hit.get("relevance"))

# Verify a generated answer against the KB. conversation_id is required.
report = client.verify.check(
    "Cerid uses Neo4j for graph storage.",
    conversation_id="demo",
)
for claim in report.claims:
    print(claim["claim"], claim["status"], claim["confidence"])
print(report.summary["overall_confidence"], "nli_skipped:", report.nli_skipped)

# Extract memories from a conversation. On a server running the extraction
# queue this returns a 202 envelope to poll instead of an inline result.
result = client.memory.extract("I prefer dark mode.", conversation_id="demo")
if isinstance(result, MemoryExtractAcceptedResponse):
    job = client.memory.get_job(result.job_id)
    print(job.status)
else:
    print(result.memories_stored, "memories stored")

client.close()

Async client

import asyncio
from cerid import AsyncCeridClient

async def main():
    async with AsyncCeridClient(
        base_url="http://localhost:8888",
        client_id="my-app",
    ) as client:
        answer = await client.kb.query("graph databases")
        print(answer.total_results)

asyncio.run(main())

Resource groups

Group Endpoints Purpose
client.kb query, search, ingest, ingest_file, ingest_external, collections, taxonomy Search + ingest the personal knowledge base
client.verify check Claim extraction + NLI-gated verification
client.memory extract, get_job Memory extraction, sync or queued
client.llm complete Smart-routed completion across model tiers
client.system health, health_detailed, settings, plugins Operational endpoints

Authentication

Cerid is local-first: a self-hosted instance needs no credentials beyond the client_id. Servers that set CERID_API_KEY also require an API key, which the client sends as X-API-Key:

client = CeridClient(
    base_url="https://cerid.your-org.internal",
    client_id="my-app",
    api_key="sk-cerid-...",  # pragma: allowlist secret
)

Errors

Every non-2xx response raises a typed error carrying the HTTP status:

Error Raised on
AuthenticationError 401 / 403
NotFoundError 404
ValidationError 422
RateLimitError 429 — retry_after carries Retry-After when the server sends it
ServiceUnavailableError 503
ProtocolVersionError server reports an incompatible wire-protocol major version
CeridSDKError base class; raised directly for any other non-2xx

Compatibility

  • Python 3.9+ (3.11 / 3.12 actively tested)
  • httpx 0.25+ (transport)
  • pydantic 2.0+ (response models)

Stability contract

The /sdk/v1/ surface and this client's public types (CeridClient, AsyncCeridClient, the error hierarchy, response models) follow semantic versioning. Any breaking change to a /sdk/v1/ endpoint is caught by the spec drift check in the server repo's CI (scripts/gen_sdk_openapi.py --check, run in the lint job).

SDK_PROTOCOL_VERSION in cerid.__version__ pins the wire-protocol version this client was built against. client.system.health(), health_detailed() and settings() compare it against the version the server reports and raise ProtocolVersionError on a major-version mismatch, rather than letting payload skew pass silently.

License

Apache-2.0. Source at the Cerid AI repository.

Metadata

Release files for cerid-sdk 0.2.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 cerid-sdk 0.2.2
File Size Uploaded
cerid_sdk-0.2.2.tar.gz 34.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cerid-sdk 0.2.2
File Interpreter ABI Platform
cerid_sdk-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 57.2 kB

Release files / cerid_sdk-0.2.2.tar.gz

Download URL cerid_sdk-0.2.2.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c47cc547e7fb259a3f3be1d3da01ccc132be08a872c67199f64db1ab64e4ac5f
BLAKE2b-256 checksum
How to use checksums
ce3a71c661e162ea816017c254ad81719eb4377b726809bb164cc6f0da67ce5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 8, 2026.

Transparency log

Release files / cerid_sdk-0.2.2-py3-none-any.whl

Download URL cerid_sdk-0.2.2-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e40b25a7865a9e81e20ec1f55ee3bcfaf047f6c73cc9a3eb7f8069ed8da6b57b
BLAKE2b-256 checksum
How to use checksums
4ee2c3f6171a79e757e4dcf16e24fc1e8cf11e4bc19b45a322246aa984a07607
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.1.1

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