Skip to main content

kaneme

from kaneme import KanemeClient

kaneme = KanemeClient(api_key="kaneme_…")
verdict = kaneme.verify_authorship(text="…", question="q1")

Sur Q2, la réponse contient aussi explanation avec les écarts observés de cadence, registre, structure et lexique. Ils éclairent le verdict sans prétendre décomposer la probabilité produite par la couche profonde :

q2 = kaneme.verify_authorship(text="…", question="q2", profile_id=profile_id)
for factor in q2.get("explanation", {}).get("factors", []):
    print(factor["label"], factor["status"], factor["detail"])

Le SDK n’ajoute aucune dépendance. Les méthodes d’écriture acceptent idempotency_key. Les erreurs lèvent KanemeAPIError.

Sécurité du transport

Depuis la version 1.16.1, le client impose HTTPS hors développement local, refuse toute redirection vers une autre origine et coupe les réponses trop volumineuses. Ces protections empêchent qu’une redirection malveillante reçoive la clé API et qu’une réponse incontrôlée épuise la mémoire du processus :

kaneme = KanemeClient(
    api_key="kaneme_…",
    timeout=15,
    max_response_bytes=4 * 1024 * 1024,
)

La limite par défaut est de 8 Mio (64 Mio au maximum). Une redirection refusée lève KanemeRedirectError ; un dépassement lève KanemeResponseTooLarge.

Cadence et identifiant de requête

Chaque réponse — succès compris — porte la cadence appliquée. on_response la donne, sur les appels qui marchent comme sur les refus :

def tracer(meta):
    if meta.rate_limit.remaining is not None and meta.rate_limit.remaining < 5:
        time.sleep(1)          # ralentir AVANT le refus
    print(meta.request_id)     # à journaliser : c'est ce qu'on te demandera

kaneme = KanemeClient(api_key="kaneme_…", on_response=tracer)

Retry-After ne part que sur un 429, et se lit alors sur l’erreur : error.metadata.retry_after. Sur un succès il vaut None — un ordre d’attendre n’a pas de sens sur un appel qui a réussi.

Certificats et cycle de vie

Une clé API dotée explicitement de voice:certify peut préparer puis publier un certificat. Les liens de page, JSON et badge sont utilisables sans ouvrir le compte Kaneme :

preparation = kaneme.prepare_certificate(document_id, display_name="Alice")
# En OAuth, ouvrir preparation["approvalUrl"] et attendre la validation humaine.
certificate = kaneme.publish_certificate(
    preparation["approvalId"],
    idempotency_key=f"certificate-{preparation['approvalId']}",
)
print(certificate["certificateUrl"], certificate["verificationUrl"], certificate["badgeSvgUrl"])

list_trash, list_project_contexts et manage_lifecycle couvrent la corbeille, la restauration, l’archivage, l’expiration et la révocation. Il n’y a aucune purge définitive dans le SDK ; utilisez dry_run=True avant une mutation sensible et limitez chaque lot à 10 éléments.

Release files for kaneme 2.10.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 kaneme 2.10.0
File Size Uploaded
kaneme-2.10.0.tar.gz 41.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kaneme 2.10.0
File Interpreter ABI Platform
kaneme-2.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 78.6 kB

Release files / kaneme-2.10.0.tar.gz

Download URL kaneme-2.10.0.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c9b5f9b6c94c0a11ea1a2ed0a1000ed04a9bcb70b58388690156242c66e5c11b
BLAKE2b-256 checksum
How to use checksums
6ec1f4340a67392af61ff45d6adf3b4afa36bb463ce8076c124e82ae9e1dadb4
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 Sep 25, 2026.

Transparency log

Release files / kaneme-2.10.0-py3-none-any.whl

Download URL kaneme-2.10.0-py3-none-any.whl
Size 37.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae024401c73d8af4ff8c839f223d047835ab765773323c64287fc48baa75fb06
BLAKE2b-256 checksum
How to use checksums
9c50b0c9b42304125dcad0cd80aafb7a65b18c6f23fcb669fa420959d5eb47fb
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 Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.10.0 This release

2 release files

2.5.0

2 release files

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