Skip to main content

cred-protocol

Async Python client and FastAPI dependency for the Cred Protocol trust evaluation API — composite trust scores (credit, sybil resistance, identity) for any Ethereum wallet, with policy templates and gates.

pip install cred-protocol            # core client (httpx)
pip install "cred-protocol[fastapi]" # + FastAPI dependency
pip install "cred-protocol[x402]"    # + Know Your Agent hooks for x402 sellers

Quick start

import asyncio
from cred_protocol import CredClient

async def main():
    async with CredClient(api_key="cred_sk_...") as cred:
        result = await cred.evaluate(
            wallet_address="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
            policy="standard",
        )
        print(result.trust_score)  # 0-100
        print(result.trust_tier)   # TrustTier.VERIFIED
        print(result.all_passed)   # True

asyncio.run(main())

Custom gates instead of a policy template:

result = await cred.evaluate(
    wallet_address="0x...",
    gates=["human", "verified", "established"],
    operator="WEIGHTED",
    weights={"human": 0.4, "verified": 0.35, "established": 0.25},
    composite_threshold=60,
)

FastAPI

import os
from fastapi import Depends, FastAPI
from cred_protocol import TrustResult
from cred_protocol.fastapi import require_trust

app = FastAPI()

@app.get("/resource")
async def get_resource(
    trust: TrustResult = Depends(require_trust(api_key=os.environ["CRED_API_KEY"], policy="standard")),
):
    return {"wallet": trust.wallet_address, "score": trust.trust_score, "tier": trust.trust_tier.value}

require_trust(..., on_fail="deny" | "challenge" | "pass") returns 403, 402 or lets the request through when the wallet fails the policy.

Screen x402 payers (Know Your Agent)

Selling over x402? Screen every paying AI agent with Cred's Know Your Agent check before its payment settles:

import os
from x402.server import x402ResourceServer
from cred_protocol import register_cred_kya

server = x402ResourceServer(facilitator_client).register("eip155:8453", ExactEvmServerScheme())
register_cred_kya(server, api_key=os.environ["CRED_API_KEY"])
  • Both servers. Works with x402ResourceServer (async) and x402ResourceServerSync, and with every x402 payment flow.
  • Refusing a payer. A refused payer gets a 402 with error set to payer_sanctioned, payer_needs_review, payer_not_registered_agent or payer_screening_unavailable, and the payment never settles.
  • Policy. CredKyaPolicy sets what to do with review verdicts, which flags always refuse, plain (non-agent) wallets, and what to do when Cred is unavailable.
  • Failing open. Even when failing open, a sanctioned payer is always refused.

See the Python SDK docs.

MIT License.

Metadata

Release files for cred-protocol 0.2.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 cred-protocol 0.2.0
File Size Uploaded Provenance Actions
cred_protocol-0.2.0.tar.gz 45.1 kB Without provenance Details for cred_protocol-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cred-protocol 0.2.0
File Interpreter ABI Platform Actions
cred_protocol-0.2.0-py3-none-any.whl Python 3 none any Details for cred_protocol-0.2.0-py3-none-any.whl

Total release size: 59.9 kB

Release files / cred_protocol-0.2.0.tar.gz

Download URL cred_protocol-0.2.0.tar.gz
Size 45.1 kB
Tags Source
SHA-256 checksum
How to use checksums
476bbd36f0162fb1153c34cd7b923913c3463f12c4c45e85a2ff8ac4040b7133
BLAKE2b-256 checksum
How to use checksums
e6a8a991fbf1a5564192687d700163b98c200b607926b335f4c7c6696b12e8f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / cred_protocol-0.2.0-py3-none-any.whl

Download URL cred_protocol-0.2.0-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e12a931a56b606d57bd0defe7d657af9a0c18f50dd60d7c75ff1a3257c862cee
BLAKE2b-256 checksum
How to use checksums
6d6bf0a6a0500a3c427ad347a47aeec01fa0a6ba325155fc763f692d7bcea9f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for cred-protocol 0.2.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

0.2.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