Skip to main content

apifix

Apifix migrates Python code across breaking library API changes. An LLM rewrites the affected code; apifix then runs the project's own tests before and after the change in an offline Docker sandbox, rejects removed or weakened tests, and measures how much of the changed code the tests actually ran.

What it does

When a library ships a breaking change (for example, the OpenAI Python SDK 1.0 removed openai.ChatCompletion.create), apifix:

  1. finds the affected code (Python ast, no LLM);
  2. rewrites the affected files with an LLM;
  3. verifies the result: the project's tests run in a Docker sandbox with no network, before and after the change; tests are compared one by one, and removed or weakened tests are rejected;
  4. reports a verdict, and can turn a verified fix into a pull request that states it was written by an AI model.

Installation

Requirements: Python 3.11+, Docker, git. The GitHub CLI (gh) is needed only to open pull requests.

pip install apifix

For development:

git clone https://github.com/theicelotus/apifix.git
cd apifix
pip install -e '.[dev]'

Usage

apifix scan path/to/repo --migration openai-v1            # what would change

export APIFIX_LLM_API_KEY=...                             # key for your endpoint
apifix fix path/to/repo --migration openai-v1 \
    --provider openai-compat --base-url <endpoint> --model <model> \
    --edit-mode whole-file --no-cost-limit                # fix and verify

apifix pr apifix-out/<run> --repo path/to/repo            # branch + PR text

--base-url takes any OpenAI-compatible endpoint. With a local model through Ollama (--base-url http://localhost:11434/v1 --model qwen2.5-coder:14b), your code never leaves your machine. Claude is the default provider (ANTHROPIC_API_KEY). Free hosted tiers may keep what you send, so use them only for public code.

Your repository is never modified: apifix works on a copy and writes fix.diff, report.md, verification.json and trajectory.json to apifix-out/<timestamp>/.

Tested on

7 public open-source repos, with the open-weight model gpt-oss-120b:

Repo Result
brianAbell/AI-powered-Resume-Analyzer-and-Feedback-Generator verified
biobootloader/wolverine verified
openai/bugbounty-gpt verified
rgbkrk/genai verified
MattOates/djgpt verified, weak evidence
HCAI-Lab-GT/SuspensePerception verified, weak evidence
stoyan-stoyanov/llmflows verified, weak evidence

Verified: the tests pass before and after, and they run at least half of the changed lines. Weak evidence: the tests pass but run less than half of the changed lines, so those lines are listed for review by hand. Diffs, reports and how each run was made: docs/guide.md.

Documentation

docs/guide.md: all commands and options, the sandbox, model choices (local and hosted), pull requests, and detailed results.

License

MIT

Metadata

Release files for apifix 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 apifix 0.1.0
File Size Uploaded Provenance
apifix-0.1.0.tar.gz 874.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / apifix-0.1.0.tar.gz

Download URL apifix-0.1.0.tar.gz
Size 874.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c0d0a53c9949370e3ef5c49ea40445524a3d61025f5221dad24df7e388af1873
BLAKE2b-256 checksum
How to use checksums
a1801f2583b1eee1dbf36f068087af5588b527dff1c806ddbbd567f0f915dc24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

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

Download URL apifix-0.1.0-py3-none-any.whl
Size 303.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b4ed1c33121e1e5eece54352c6e0811e7c4b1a9b47c2ae2a42dcde962ecc337
BLAKE2b-256 checksum
How to use checksums
4acfaa850f85929ac885bdef9834afc4859d944a8f54d5054a2a710bf906bc02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for apifix 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