Skip to main content

cached-openrouter

OpenRouter client that records and replays API responses. Based on cached_openai by Daniel Guetta.

Install

pip install cached-openrouter

Usage

import cached_openrouter

# Step 1 — record real API calls
client = cached_openrouter.OpenAI(api_key='sk-or-v1-...')
resp = client.chat.completions.create(
    model    = 'openai/gpt-4o-mini',
    messages = [{'role': 'user', 'content': 'What is a cache?'}],
)
print(resp.choices[0].message.content)

# Step 2 — save to a file
cached_openrouter.materialize('course.cache')

# Step 3 — load and serve with no API key
student = cached_openrouter.load('course.cache')
resp = student.chat.completions.create(
    model    = 'openai/gpt-4o-mini',
    messages = [{'role': 'user', 'content': 'What is a cache?'}],
)
print(resp.choices[0].message.content)  # served from cache instantly

Metadata

Release files for cached-openrouter 0.1.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 cached-openrouter 0.1.0
File Size Uploaded Provenance Actions
cached_openrouter-0.1.0.tar.gz 3.1 kB Without provenance Details for cached_openrouter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cached-openrouter 0.1.0
File Interpreter ABI Platform Actions
cached_openrouter-0.1.0-py3-none-any.whl Python 3 none any Details for cached_openrouter-0.1.0-py3-none-any.whl

Total release size: 6.6 kB

Release files / cached_openrouter-0.1.0.tar.gz

Download URL cached_openrouter-0.1.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ee62c11e395de1b346753cf258ac9ff4831a80a327d1062d7b5a3bd3830c93a7
BLAKE2b-256 checksum
How to use checksums
c44ab7792f14bad8e6aebacc3486737ac22d98e2d09cf0c3f6a7e9420bc42b95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / cached_openrouter-0.1.0-py3-none-any.whl

Download URL cached_openrouter-0.1.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48b7ab2b36c9c4268d01316b38707d427afc098fce5c70f7ba71645a5dda85b1
BLAKE2b-256 checksum
How to use checksums
2468959b47776c25c60c30fa9d964dfa528ce752ecf81f4ed0057c14e1e60613
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for cached-openrouter 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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