Skip to main content

Talkory: AI answer comparison and consensus platform. Official Python SDK.

Project description

talkory

Official Python SDK for Talkory.ai: ask once, hear from five LLMs (GPT, Claude, Gemini, Grok, Perplexity), get a consensus answer.

pip install talkory

Quickstart

Create an API key at app.talkory.ai (Settings → API Keys), then:

from talkory import Talkory

client = Talkory()  # reads TALKORY_API_KEY from the environment

result = client.queries.run("Best commuter motorcycles under $5000?")
print(result.consensus)       # synthesized consensus answer
print(result.common_answer)   # what the models agreed on
print(result.confidence)      # 0-100
print(result.charged)         # USD charged for this run

queries.run() blocks until the run finishes (can take a few minutes; the read timeout defaults to 600s per the API docs).

Fire-and-forget + poll

run = client.queries.create("Compare Python web frameworks in 2026")
result = client.queries.wait(run.id)      # polls with gentle backoff

Choosing models

models = client.models.list()             # free
result = client.queries.run(
    "Is a heat pump worth it in Delhi?",
    models=["gpt", "claude"],             # subset (max 10)
    recursive=True,                       # round-2 self-review before consensus
    country="in",                         # localization
)

Free endpoints

client.health.check()                     # LLM provider health
client.wallet.get()                       # balance
client.usage.get(from_="2026-06-01")      # usage stats for this key
client.queries.retrieve(query_id)         # past result by id
for q in client.queries.list(limit=50):   # auto-paginating history
    print(q.id, q.prompt, q.charged)

Deferred consensus

result = client.queries.run("...", consensus=False)   # cheaper
later = client.queries.consensus(result.id)           # idempotent; cached re-calls charge $0

Errors

Every documented API error maps to a typed exception carrying code, status, message, and request_id (quote the request_id in support tickets):

from talkory import RateLimitError, InsufficientBalanceError, TalkoryError

try:
    result = client.queries.run("...")
except RateLimitError as e:
    time.sleep(e.retry_after or 30)
except InsufficientBalanceError:
    ...  # top up at app.talkory.ai
except TalkoryError as e:
    print(e.code, e.request_id)

Wallet safety

The SDK never auto-retries paid POST requests. If a connection drops after a run starts, the run still completes (and charges) server-side, and retrying blindly would double-spend your wallet. On timeout/disconnect, check client.queries.retrieve(id) first. Free idempotent GETs are retried automatically on 429/500/503, honoring Retry-After.

Security

  • Key resolution: explicit api_key= argument → TALKORY_API_KEY env var. The SDK never reads or writes keys to disk.
  • Keys are redacted everywhere they could leak: repr(), exception messages, logs show tk_live_***a1b2 at most.
  • HTTPS is enforced; a plain-HTTP base_url is refused unless you explicitly pass allow_insecure=True (local testing only).
  • Zero telemetry: the SDK makes no network calls other than the API requests you invoke. The only metadata sent is User-Agent: talkory-python/{version} python/{py_version}.
  • Never embed keys in frontend/browser code; call Talkory from your backend.

See SECURITY.md for vulnerability reporting.

Requirements

Python 3.9+ · httpx · pydantic v2. Fully typed (py.typed).

Links

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

talkory-0.0.4.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

talkory-0.0.4-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for talkory-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a8faf45eee6c32b9288d2034340d732ee676e7a4616cb8f9887834ed3c59f9f6
MD5 eed3179676784908ced7e138530e8896
BLAKE2b-256 7f51b9b193de2d9c4227493f5b62223cf6395afe118e8a1ed59ad309bd3dae1f

See more details on using hashes here.

Provenance

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

Publisher: main.yaml on talkory-ai/talkory-python-pip

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

File details

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

File metadata

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

File hashes

Hashes for talkory-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 645b0b2f65b8cf85c619232cb83b542206a6bdb8bcc3f478431b2990ae2dfb41
MD5 3b5c4a6782327801385cf41ab04c6079
BLAKE2b-256 bd4ef8d5b1813d2475e03e6f70a5554b4d5ec17198471284af104d569be19764

See more details on using hashes here.

Provenance

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

Publisher: main.yaml on talkory-ai/talkory-python-pip

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