Skip to main content

straleio

Python client for the Strale API: call any Strale tool from your code with one API key, paid per call from your Strale balance.

Install

pip install straleio

Quick start

import os
from straleio import Strale, DoRequest

strale = Strale(api_key=os.environ["STRALE_API_KEY"])

result = strale.do(DoRequest(
    capability_slug="vat-validate",
    inputs={"vat_number": "SE556703748501"},
    max_price_cents=10,
))

print(result.output)      # the tool's structured fields
print(result.provenance)  # Provenance(source=..., fetched_at=...)

do() takes a DoRequest and returns a DoResponse, or a DryRunResponse when dry_run=True (the return type is the union of the two). max_price_cents is required: it caps what one call may cost, and the call is refused with budget_exceeded if the tool costs more. The API also has a hard ceiling per request. Each tool's inputs, output fields and price are on its page at strale.io/tools and in strale.capability(slug).

Describe the task instead of naming the tool

result = strale.do(DoRequest(task="validate VAT number SE556703748501", max_price_cents=10))
print(result.capability_used)  # the tool Strale matched

Dry run: see what would run and what it costs

preview = strale.do(DoRequest(
    task="look up Swedish company 556703-7485",
    max_price_cents=50,
    dry_run=True,
))

print(preview.would_execute)      # the tool that would run
print(preview.price_cents)        # its price
print(preview.wallet_sufficient)  # whether your balance covers it

Balance, tools and past calls

balance = strale.balance()            # BalanceResponse(balance_cents=..., currency=...)
tools = strale.capabilities()         # every tool: slug, name, description, category, price_cents, schemas
tool = strale.capability("vat-validate")
recent = strale.transactions()
one = strale.transaction(recent[0].id)

The client holds an HTTP connection pool. Use it as a context manager, or call close():

with Strale(api_key=os.environ["STRALE_API_KEY"]) as strale:
    ...

Bundled checks

Bundled checks (for example kyb-essentials-se) are not in this client yet. Call them over REST:

import httpx

res = httpx.post(
    "https://api.strale.io/v1/solutions/kyb-essentials-se/execute",
    headers={"Authorization": f"Bearer {os.environ['STRALE_API_KEY']}"},
    json={"inputs": {"org_number": "5567037485"}},
    timeout=120,
)

Each bundle's inputs and price are on its page at strale.io/tools.

Free tools

This client always sends an API key. Free tools cost nothing with a key. They also work without any key under a monthly per-IP allowance (see GET /v1/platform/facts, static.free_tier_monthly_limit), if you call the REST API directly:

curl -X POST https://api.strale.io/v1/do?src=pypi-readme \
  -H 'Content-Type: application/json' \
  -d '{"capability_slug": "email-validate", "inputs": {"email": "hello@example.com"}}'

The current list of free tools is free_tier_slugs in /v1/platform/facts.

Options

strale = Strale(
    api_key="sk_live_...",              # required
    base_url="https://api.strale.io",   # default
    timeout=60.0,                       # seconds per HTTP request, default 60
    default_max_price_cents=100,        # used when a DoRequest leaves max_price_cents falsy; no default
    poll_interval=2.0,                  # seconds between polls for long-running calls
    max_poll_wait=120.0,                # seconds to keep polling before giving up
)

Error handling

from straleio import StraleError, InsufficientBalanceError

try:
    strale.do(DoRequest(capability_slug="vat-validate", inputs={"vat_number": "SE556703748501"}, max_price_cents=10))
except InsufficientBalanceError:
    ...  # top up at https://strale.io/topup?src=pypi-readme&utm_source=pypi-readme&utm_medium=listing&utm_campaign=distribution-d0-d1
except StraleError as e:
    print(e.error_code, e.status_code, e)

Common error_code values include insufficient_balance, budget_exceeded (the tool costs more than max_price_cents), spend_cap_exceeded, no_matching_capability, capability_unavailable, execution_failed, timeout_exceeded, invalid_request, rate_limited, unauthorized and not_found. Codes without their own error class arrive as a plain StraleError.

Resources

License

MIT — see LICENSE

Metadata

Release files for straleio 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for straleio 0.1.5
File Size Uploaded Provenance Actions
straleio-0.1.5.tar.gz 12.4 kB With provenance Details for straleio-0.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 24.0 kB

Release files / straleio-0.1.5.tar.gz

Download URL straleio-0.1.5.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eb1b7405a5a98b23aecee4f1cac65c07a8d2b619cdbe3515193400ac736ea0dd
BLAKE2b-256 checksum
How to use checksums
a7606b149edbf20f175ebfe4a014b696cf4a6c82386b727533c74e709a064e4f
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 Nov 12, 2026.

Transparency log

Release files / straleio-0.1.5-py3-none-any.whl

Download URL straleio-0.1.5-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a77eb5ea47377c8d2e5a28359b496c234d400492bc84baee38b8c3e16ebc0a0
BLAKE2b-256 checksum
How to use checksums
df695df5594d534cbe5cc2b063c5812a15f3226dd4a02e6eef7a80164b519fee
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 Nov 12, 2026.

Transparency log

Security for straleio 0.1.5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for straleio-0.1.5.tar.gz

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 Nov 12, 2026.

Transparency log

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.

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