Skip to main content

Drop-in token optimization for the OpenAI & Anthropic SDKs — change one import, cut your token bill.

Project description

Refutics — Python SDK

Drop-in token optimization. Change one import, cut your token bill. Streaming, tools, and vision keep working — these are thin wrappers over the official SDKs.

Install

pip install refutics openai          # for OpenAI / OpenAI-compatible / Azure
pip install refutics anthropic       # for Anthropic

Use — one import change

# before:  from openai import OpenAI
from refutics import OpenAI

client = OpenAI()                                   # reads REFUTICS_TOKEN from env
resp = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "hello"}],
)

Set your token once:

export REFUTICS_TOKEN=dtras_live_…

Any provider — one token

client = OpenAI(provider="groq")        # or mistral, deepseek, together, xai, fireworks, gemini…

Anthropic

from refutics import Anthropic
client = Anthropic()                                # reads REFUTICS_TOKEN
client.messages.create(model="claude-3-5-sonnet-latest", max_tokens=256, messages=[...])

Azure OpenAI

from refutics import AzureOpenAI
client = AzureOpenAI(
    azure_resource="https://my-company.openai.azure.com",
    api_version="2024-02-01",
)
client.chat.completions.create(model="<your-deployment>", messages=[...])

Provider key

  • Stored (recommended): add your provider key once in the Refutics dashboard — pass nothing.
  • BYOK: OpenAI(provider_key="sk-…") — never stored.

Optional: auto model-routing (save more)

client = OpenAI(route=True)   # downgrades clearly-easy prompts to a cheaper model

That's it — same SDK, same answers, smaller bill.

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

refutics-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

refutics-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file refutics-0.1.0.tar.gz.

File metadata

  • Download URL: refutics-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for refutics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db36c7821258401c9b4afbfaecf5342316d29f299bffd8e79473696dde60d833
MD5 c346f7efa3c511413aac22287bf90299
BLAKE2b-256 7d576a8de487d7fb58e0d10f27be5262e8a0a3431e0e9d93952386db4e165565

See more details on using hashes here.

File details

Details for the file refutics-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: refutics-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for refutics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 359780174f131e530cd700b227adc51a31e832df80e339f14ee0dbdea3afaa3b
MD5 cb7c759e052a58b97cd7ee0cd52ed734
BLAKE2b-256 51b5efa169e117e9196b29fcd3b52d2ea96be2b5faafc4a36ddfb6cdcaee5e5b

See more details on using hashes here.

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