fireworks2bedrock-migrate
One command migrates a Python repository's Kimi K3 inference from Fireworks to Amazon Bedrock. It scans the repository, rewrites the inference calls, adds a small runtime helper, and opens a pull request. The model is unchanged — only the backend changes.
- Model ID:
accounts/fireworks/models/kimi-k3→global.moonshotai.kimi-k3(orus.moonshotai.kimi-k3with--us-only) - Requests route through Bedrock's OpenAI-compatible Chat Completions API — no Bedrock SDK required
- Fine-tuned models, adapters, and non-inference APIs are detected and left untouched
Requirements
- Python 3.9+
- A git repository for the branch/commit/PR flow (or
--no-gitto skip git entirely) - To open the PR: the
ghCLI or a git credential helper with a GitHub token - At deploy time: an AWS role with
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamfor the Kimi K3 inference profile
Installation
pip install fireworks2bedrock-migrate
Or run it once without installing:
uvx fireworks2bedrock-migrate migrate --pr
# or
pipx run fireworks2bedrock-migrate migrate --pr
Quick start
cd path/to/your-repo
fireworks2bedrock-migrate migrate --pr
On a git repository with a clean working tree, this checks out the branch f2b/kimi-k3-bedrock, rewrites every base Kimi K3 call site, adds the helper/config/dependencies, writes a migration report, pushes the branch, and opens a pull request.
Commands
fireworks2bedrock-migrate scan [PATH] [--json]
fireworks2bedrock-migrate migrate [PATH] [options]
PATH defaults to the current directory.
scan — report without changing anything
Lists every Fireworks touchpoint and how it would be handled:
fireworks2bedrock-migrate scan . --json
migrate — apply the migration
| Option | Effect |
|---|---|
--pr |
push the branch and open a pull request |
--us-only |
target us.moonshotai.kimi-k3 instead of global.moonshotai.kimi-k3 |
--region <REGION> |
default region recorded in f2b.json (default us-east-1) |
--json |
machine-readable output on stdout |
--no-git |
skip branch/commit/push (no git required) |
What it migrates
| Call site | Before | After |
|---|---|---|
| Model ID | accounts/fireworks/models/kimi-k3 |
KIMI_K3 (global.moonshotai.kimi-k3) |
| OpenAI client | OpenAI(base_url="https://api.fireworks.ai/inference/v1") |
get_llm_client() |
| Async OpenAI | AsyncOpenAI(base_url=...) |
get_async_llm_client() |
| Fireworks SDK | Fireworks(...) / AsyncFireworks(...) |
get_llm_client() / get_async_llm_client() |
| Fireworks LLM | LLM(model=...) |
get_llm_client().bind(KIMI_K3) |
| LangChain | ChatFireworks(...) |
ChatOpenAI(..., **langchain_kwargs()) |
| Raw HTTP | requests.post("https://api.fireworks.ai/...") |
flagged for review; helper client suggested |
The LiteLLM spelling fireworks_ai/accounts/fireworks/models/kimi-k3 is rewritten too.
What it leaves alone
These are detected, left untouched, and listed in the report and f2b.json:
- Fine-tuned / uploaded models —
accounts/<account>/models/<name>where<account>is notfireworks - Non-K3 Fireworks models —
accounts/fireworks/models/<other> - Non-inference APIs —
fine_tuning,datasets,deployments,rerank,embeddings,batch,audio,image_generation - LoRA adapters and dedicated deployments
Files it adds to your repository
| File | Purpose |
|---|---|
llm_client.py |
runtime helper, co-located with the migrated files |
f2b.json |
per-model backend routing (repo root) |
requirements.txt |
adds openai and aws-bedrock-token-generator (boto3 only if a model routes to converse) |
BEDROCK_MIGRATION.md |
full change log, what was left alone, IAM policy, rollback |
How the runtime helper works
llm_client.py keeps the OpenAI shape, so migrated call sites do not change:
from llm_client import get_llm_client, KIMI_K3
client = get_llm_client()
resp = client.chat.completions.create(model=KIMI_K3, messages=[...])
Each model is routed at runtime by f2b.json:
| Backend | Meaning |
|---|---|
openai-compatible |
Bedrock's OpenAI-compatible Chat Completions API (default) |
converse |
Bedrock Converse API via boto3, OpenAI shape translated on the fly |
fireworks |
Fireworks — used for the BLOCK models and for rollback |
Bedrock requests authenticate with a short-lived token generated from the ambient AWS credentials (aws-bedrock-token-generator). The default backend uses the OpenAI-compatible endpoint (/openai/v1) rather than the Converse API, so no Bedrock SDK is required. Unknown accounts/.../models/... IDs stay on Fireworks as a safety net.
Classification and exit codes
Each finding is classified MIGRATE, BLOCK, or REVIEW. REVIEW items — for example a client whose base_url is assembled at runtime, or a model ID built from an f-string — need a decision before deploy and are listed in the report and in the JSON review_items field.
| Exit code | Meaning |
|---|---|
0 |
migration applied (and PR opened with --pr) |
20 |
nothing to migrate, or already migrated |
30 |
environment problem (not a directory, dirty working tree, or checkout failed) |
JSON output
scan --json and migrate --json each emit one JSON document:
{
"version": "0.0.2",
"repo": "/abs/path/to/repo",
"language": "python",
"branch": "f2b/kimi-k3-bedrock",
"pr_url": "https://github.com/acme/repo/pull/12",
"findings": [
{
"class": "MIGRATE",
"file": "app/llm.py",
"line": 14,
"kind": "openai_client",
"detail": "OpenAI(base_url=fireworks) -> get_llm_client()"
}
],
"checks": [],
"review_items": [],
"exit_code": 0
}
checks is reserved for future automatic verification and is empty today.
Rollback
Set F2B_BACKEND=fireworks to route back to Fireworks with no code change.
Idempotency
Running migrate on an already-migrated repository is a no-op and exits 20.
License
Apache-2.0
Metadata
Release files for fireworks2bedrock-migrate 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fireworks2bedrock_migrate-0.0.2.tar.gz | 22.0 kB | Without provenance | Details for fireworks2bedrock_migrate-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fireworks2bedrock_migrate-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for fireworks2bedrock_migrate-0.0.2-py3-none-any.whl |
Total release size: 44.1 kB
Release files / fireworks2bedrock_migrate-0.0.2.tar.gz
| Download URL | fireworks2bedrock_migrate-0.0.2.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dba274a81b5c839ad41605078e7173526b5c60dba25aa8867b3c2826f3285a37
|
|
BLAKE2b-256 checksum How to use checksums |
1cf82263881be63a76812ebded5f0dfd6412c7a5fb41c85fe4d8b2ed83468787
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / fireworks2bedrock_migrate-0.0.2-py3-none-any.whl
| Download URL | fireworks2bedrock_migrate-0.0.2-py3-none-any.whl |
|---|---|
| Size | 22.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25307db9c6382ffccaa914772259b3ab64c1ead0a49c35e34b384a0d96d9f744
|
|
BLAKE2b-256 checksum How to use checksums |
c9dc7613244818d7aade8edc6ecbee7a26cc83a6f9371dd6e39dba1798861742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for fireworks2bedrock-migrate 0.0.2
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.