Skip to main content

Rayon Python SDK

Rayon manages current material for supported public sources. Send the source-page URL, profile and exact request. No script collection or preparation is needed for this header flow. Replace the reserved example URLs with your approved source and endpoint. {} uses default profile values; supply measured values when needed.

Keep the API key server-side. Your integration owns the target HTTP client, authentication, cookies and session. Rayon generates telemetry; your client sends the target request.

Quickstart · Material options · API reference

Install

Custom material must be prepared before generation. Deploy the compatible server before migrating clients.

Requires Python 3.10+.

python -m pip install 'rayon-sdk-py>=3.0.0,<4'

Generate

import os
from rayon_sdk_py import Client

shape = {
    "source_url": "https://shop.example.com/account",
    "profile": {},
    "request": {
        "url": "https://shop.example.com/api/check",
        "method": "POST",
        "content_type": "application/json",
        "body": "{}",
    },
}
with Client(os.environ["RAYON_API_KEY"]) as client:
    result = client.generate(shape)
    # Apply result.headers with your target client. Keep client open for further calls.

Use AsyncClient with async with and await client.generate(shape) in async applications. Both clients accept the same inputs and return the same metadata.

Apply every returned header unchanged, including optional a0, to the exact request. Keep application headers and session state in your target client. Generate fresh telemetry for each request and inspect the target response to check acceptance. Rayon returns no target cookies.

Material and readiness

Generation accepts ready managed material or a ready private reference. Custom scripts must go through preparation. Unsupported, expired or unprepared inputs return an explicit error. Generation does not prepare material or retry automatically.

Custom material requires preparation

Preparation can take several minutes. Wait helpers return as soon as ready, with a 30-minute default limit. Timeouts and cancellation leave the job available to resume.

ready = client.prepare_and_wait(explicit_shape)
context = {k: v for k, v in explicit_shape.items() if k not in ("scripts", "material_ref")}
result = client.generate({**context, "material_ref": ready.material_ref})

Submit complete sources and the intended context with the preparation helper. Wait for state: ready, then use its material_ref for generation. A queued job can already contain a reference; that does not establish readiness. Readiness is scoped to supported inputs. Normal request inputs may vary only within that documented scope; an unchanged program does not establish universal coverage.

Refresh custom material outside generation before the earlier of ready_until and material_expires_at, or after a supported deployment change. Wait for the replacement to become ready before switching references. Keep original sources on your side for refresh. Expired references are never recovered by uploading scripts to a solve call. For managed header calls, keep both material fields omitted on every request. Form mode requires an explicit ready reference.

Client options and errors

Reuse one client for connections. usage() is a free access/allowance check. Default API URL: https://api.rayonapi.com; timeout: 45 seconds. Set base_url or timeout in the constructor. Use validate_profile for offline validation.

Errors inherit RayonError: ValidationError, TransportError, HTTPError and InvalidResponseError. Metadata includes status_code, request_id, code, retry_after, reason, action, domain, field, billing_status and retryable when available. Check request history before retrying a timeout or uncertain billing outcome. Generation is never automatically retried. Refresh expired custom material through preparation before resubmitting a solve.

The client retains no solve-upload source cache. Automatic generation never pins a returned reference. The SDK does not fetch target scripts, send target requests or cache generated telemetry.

Errors · Release instructions · Support · MIT license

Metadata

Release files for rayon-sdk-py 3.0.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 rayon-sdk-py 3.0.0
File Size Uploaded Provenance Actions
rayon_sdk_py-3.0.0.tar.gz 46.6 kB With provenance Details for rayon_sdk_py-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rayon-sdk-py 3.0.0
File Interpreter ABI Platform Actions
rayon_sdk_py-3.0.0-py3-none-any.whl Python 3 none any Details for rayon_sdk_py-3.0.0-py3-none-any.whl

Total release size: 68.6 kB

Release files / rayon_sdk_py-3.0.0.tar.gz

Download URL rayon_sdk_py-3.0.0.tar.gz
Size 46.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8d4393d73bf26e0d9e417b56a925a705b69f0b0cbff4efd68db516b1aaa01e5a
BLAKE2b-256 checksum
How to use checksums
9a6cf557bfc18ca4e9342ece880fc8a57267947075b32c7d4fdb55b76e6d07f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 11, 2026.

Transparency log

Release files / rayon_sdk_py-3.0.0-py3-none-any.whl

Download URL rayon_sdk_py-3.0.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9deda41c43e11961bdf7c9c6b6c2b97250385fbf911c47b52e543ff765e2073
BLAKE2b-256 checksum
How to use checksums
5190aac1bc8b62e1c44254a74c506ff29a8f4388a6ca1d2a7004f456b933de63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 11, 2026.

Transparency log

Security for rayon-sdk-py 3.0.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.

Full provenance

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

Select from 2 files

Attestation for rayon_sdk_py-3.0.0.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 11, 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