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.1,<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.

SDK 3.0.1 accepts a successful managed preparation fallback with path: isolated and fallback_reason: material_preparing. These fields remain available on the result so your application can report degraded operation. The SDK advertises this capability automatically; generation request bodies stay unchanged. Older SDKs remain native-only on a server configured for the capability migration. A fallback requires fresh managed material and is never an automatic retry by the SDK.

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

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.1
File Size Uploaded Provenance Actions
rayon_sdk_py-3.0.1.tar.gz 47.6 kB With provenance Details for rayon_sdk_py-3.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 69.8 kB

Release files / rayon_sdk_py-3.0.1.tar.gz

Download URL rayon_sdk_py-3.0.1.tar.gz
Size 47.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b3cc8e2f5c6803fd80bae6f495ade8c38cd16ff545e8a64cf7375f927c0e62cb
BLAKE2b-256 checksum
How to use checksums
0aa91d01d284bb4ea62b7cc26e767d9f9bf250e1a97162635a9fa9656f75861d
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 14, 2026.

Transparency log

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

Download URL rayon_sdk_py-3.0.1-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d58a8d957ce0249882c640c496509c293eaf0075ef509cbfa61ba7be672b7960
BLAKE2b-256 checksum
How to use checksums
45fa12606888a4cf6c851d64b9d7ececdae703e29e527a2618d7d0ba684bd73b
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 14, 2026.

Transparency log

Security for rayon-sdk-py 3.0.1

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.1.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 14, 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