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 — 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.3.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.3-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: talkory-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 401e5d0cce93379a974969b4bda59d68be5763e9160936ae65a6014a898c4ad0
MD5 f3ab263ff148e20cbe64afb5cb03f613
BLAKE2b-256 7589f0aa3b465f96100933a37a53028e887bcb4517450783eb704b7886f0d864

See more details on using hashes here.

Provenance

The following attestation bundles were made for talkory-0.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: talkory-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f56d737e0f2d70899e916dd1d03f88852be752e643a860deac7f9503b88607d0
MD5 574ee714dc5f30f964ebb73c1227932d
BLAKE2b-256 f8a6a9bd496c1f060670f3f432534f378d0f41440645a4358b811483d3c56d8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for talkory-0.0.3-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