Skip to main content

Autofix Python

Self-healing HTTP transport for LLM SDKs — the OpenAI and Anthropic Python SDKs. When a request fails with a fixable request-shape error — a renamed parameter, a restricted value, a retired model — autofix repairs it at runtime and retries. Your code doesn't change; your users never see the failure.

Installation

Use one import per SDK. Routing follows the request path, including custom base_url values.

pip install mnfst-autofix

The hosted demo uses https://phoenix-yc-production.up.railway.app. Set AUTOFIX_API_KEY in your application environment (or .env when your runtime loads it) to authenticate heal requests. Use AUTOFIX_URL to override the endpoint.

Usage

from openai import OpenAI
from mnfst_autofix.openai import autofix

client = OpenAI(http_client=autofix())

res = client.chat.completions.create(
    model="gpt-5-mini",
    temperature=0.2,  # gpt-5 models reject this - normally a 400
    messages=[{"role": "user", "content": "Hello!"}],
)
# -> healed at runtime (temperature set to 1), returns a normal 200

That's the whole integration — every call on this client is self-healing.

Async works the same way:

from openai import AsyncOpenAI
from mnfst_autofix.openai import autofix_async

client = AsyncOpenAI(http_client=autofix_async())

For Anthropic:

from anthropic import Anthropic
from mnfst_autofix.anthropic import autofix

client = Anthropic(http_client=autofix())

For LiteLLM:

from openai import OpenAI
from mnfst_autofix.openai import autofix

client = OpenAI(
    base_url="http://localhost:4000/v1",
    http_client=autofix(),
)

How it works

On a 400, 404 or 422, autofix applies the privacy filter described below, asks the heal API for the current fix, applies it, and replays once. Anything goes wrong → your original error, unchanged.

Never worse than without it

  • Zero overhead on success — the transport only wakes up on a healable failure.
  • Fail open — heal API down, slow, or out of ideas: you get the original error. The heal call has a 5s budget, so it can't sit on top of a failure you're already waiting for.
  • Your key never leaves — the provider API key stays on your SDK's request, on its original path.

Privacy

The heal API receives settings, not prompt data:

// sent to the heal API
{
  "model": "gpt-5-mini",
  "temperature": 0.2
}

// kept local and restored on replay
{
  "messages": [{ "role": "user", "content": "Hello!" }],
  "tools": [...]
}

Scalar settings and scalar-only arrays may travel. Prompts, tools, nested arrays, schema bodies, identity fields, and credential fields stay local. The provider error, endpoint origin and path, derived workspace id, and SDK source are also sent.

autofix(send_messages=True) (default False) opts the top-level messages list in, verbatim — for teams pointing at their own heal service who want the conversation visible next to the failure it caused. It is observability only: the heal API still cannot author or rewrite a message on the way back.

See heals

client = OpenAI(
    http_client=autofix(
        on_heal=lambda event: print(event.heal_status, event.summary),
    ),
)

License

MIT © Manifest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mnfst_autofix-0.1.0.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

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

mnfst_autofix-0.1.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mnfst_autofix-0.1.0.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mnfst_autofix-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6558f49e7f71d4ba489eef61af9ebaf0008d4b2ef30bf6d783615fb1f9392db7
MD5 8d2ee9f34bb1b5f8b9b2f665edd5430d
BLAKE2b-256 81278c36605e4ff349fbf25691c1faf3ed63e20d98bfc1558eed35fa9a7014fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnfst_autofix-0.1.0.tar.gz:

Publisher: publish.yml on mnfst/autofix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: mnfst_autofix-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mnfst_autofix-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef00155c2c405a0085dd8adca89ccd16c1073082852d5d5324491bb0999f8bb5
MD5 51df297e8a6efc48b61424f03ace4f87
BLAKE2b-256 0ea775dd333718cb33da2244a02815274089338fb23239d661c3f26135104656

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnfst_autofix-0.1.0-py3-none-any.whl:

Publisher: publish.yml on mnfst/autofix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page