Skip to main content

Autofix Python

Self-healing HTTP transport for OpenAI, Anthropic, and native Google Gemini requests. 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

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 a native Google GenerateContent request:

from mnfst_autofix.google import autofix

client = autofix(send_messages=True)
response = client.post(
    "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
    headers={"x-goog-api-key": "..."},
    json={"contents": [{"role": "user", "parts": [{"text": "Hello!"}]}]},
)

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 or Gemini contents list in, verbatim. It is observability only: the heal API still cannot author or rewrite the conversation on the way back.

See heals

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

License

MIT © Manifest

Metadata

Release files for mnfst-autofix 0.2.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 mnfst-autofix 0.2.0
File Size Uploaded
mnfst_autofix-0.2.0.tar.gz 35.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mnfst-autofix 0.2.0
File Interpreter ABI Platform
mnfst_autofix-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 58.2 kB

Release files / mnfst_autofix-0.2.0.tar.gz

Download URL mnfst_autofix-0.2.0.tar.gz
Size 35.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fac5ee73500ef88fa3f960506601fae390403619b161b1f13578dd61f5d2b8f0
BLAKE2b-256 checksum
How to use checksums
06edaaac1adbc5de9891ba31e004a209f65ac6959eb1fa38b12fdcceb35850f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Release files / mnfst_autofix-0.2.0-py3-none-any.whl

Download URL mnfst_autofix-0.2.0-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
731d69284be089d3dd49c33429a5f5885de13e6c77a560f9ee54245de9d036e2
BLAKE2b-256 checksum
How to use checksums
d97b7f062d56ddf57b8804d592324086972360f6abbed0c7756e0b50aebf98cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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