Skip to main content

byom

Bring your own model to Claude Code and other coding agents. byom deploys SGLang on Modal or Docker and puts a small proxy in front of it that smooths over the few places where Claude Code and SGLang disagree.

pip install 'byom[modal]'
byom deploy modal --profile qwen3-coder-30b

deploy prints the environment variables for Claude Code:

export ANTHROPIC_BASE_URL=https://<you>--byom-qwen3-coder-30b-proxy.us-east.modal.direct
export ANTHROPIC_AUTH_TOKEN=sk-byom-...
export ANTHROPIC_MODEL=qwen3-coder
...
claude

Requests go straight from Claude Code to your deployment, so nothing goes to Anthropic. You pay only for the GPU.

Targets

Modal (byom deploy modal): the GPU server scales to zero after 20 idle minutes, and a small always-on CPU proxy keeps the URL stable. The first request after idle waits for the GPU to boot (about 4 minutes with cached weights) instead of failing. Needs modal setup first.

Docker (byom deploy docker): SGLang and the proxy as a Compose project on an NVIDIA machine, reachable at http://127.0.0.1:8080. Use --context <docker context> to deploy to a remote GPU box from your laptop.

Your own SGLang server: byom serve --upstream http://localhost:30000 --drop-thinking.

byom list          # deployments and profiles
byom env NAME      # print the Claude Code settings again
byom logs NAME -f
byom down NAME

Gated models need HF_TOKEN set when you deploy.

What the proxy changes

Everything is forwarded to SGLang byte for byte, except:

  • thinking is dropped for models served without a reasoning parser (Claude Code always sends it; SGLang rejects it).
  • Claude Code's per-request attribution line is removed from the system prompt so SGLang's prefix cache works.
  • x-api-key is also sent as Authorization: Bearer, which is what SGLang checks.
  • While the backend is starting, 503s and refused connections are retried instead of returned.

Profiles

A profile is a YAML file naming the model, the SGLang image and flags, and the GPU:

name: qwen3-coder-30b
model: Qwen/Qwen3-Coder-30B-A3B-Instruct-FP8
revision: dcaee4d4dfc5ee71ad501f01f530e5652438fde0
image: lmsysorg/sglang:v0.5.23-runtime
served_name: qwen3-coder
gpu: H100:1
args:
  tool_call_parser: qwen3_coder
  context_length: 131072
drop_thinking: true

Pass your own with --profile path/to/model.yaml. The model needs an SGLang --tool-call-parser, since Claude Code does everything through tool calls.

Using it from code

The same URL serves the OpenAI API under /v1, so the OpenAI SDK, Cursor and most other tools work too, including streaming, structured outputs and tool calls:

from openai import OpenAI
from byom.deploy import Deployment

dep = Deployment.load("qwen3-coder-30b")
client = OpenAI(base_url=f"{dep.url}/v1", api_key=dep.api_key, timeout=900)

for chunk in client.chat.completions.create(
    model=dep.model, stream=True,
    messages=[{"role": "user", "content": "Explain Python's GIL in two sentences."}],
):
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

docs/usage.md covers the OpenAI and Anthropic SDKs, structured outputs, tool calls, curl and Cursor. Runnable versions are in examples/:

  • claude_code_qwen.sh: deploy, then have Claude Code write and test a small program.
  • openai_sdk.py: chat, streaming, structured outputs, JSON mode, tool calls.
  • anthropic_sdk.py: messages, streaming, tool use.
  • d1_snake.py: LiquidAI's d1-2B decision model playing snake from rendered frames on a Modal GPU (modal run examples/d1_snake.py). d1 doesn't generate text, so it runs in Transformers rather than through byom.

make live NAME=<deployment> runs all of these checks against a deployment as tests.

Agent skill

skills/byom/SKILL.md teaches coding agents to deploy and connect to byom. Copy the skills/byom folder into ~/.claude/skills/ for Claude Code or ~/.cursor/skills/ for Cursor.

Development

make install   # uv sync
make check     # ruff, mypy, pytest
make live NAME=qwen3-coder-30b   # end-to-end tests against a real deployment
make bump PART=minor             # bump the version in pyproject.toml (patch, minor or major)

To release, commit the bump and publish a GitHub release tagged v<version>; the publish workflow checks the tag matches and uploads to PyPI.

Metadata

Release files for byom 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 byom 0.2.0
File Size Uploaded Provenance Actions
byom-0.2.0.tar.gz 161.2 kB With provenance Details for byom-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 178.2 kB

Release files / byom-0.2.0.tar.gz

Download URL byom-0.2.0.tar.gz
Size 161.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7b668f856c5c9afe708bcf85511658bf1590107bf1f4dc543cd8aa01833e0c66
BLAKE2b-256 checksum
How to use checksums
289265654fbfc2029acc7b3d3f6099001eec8ed83c1d271077158056038e8008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

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

Download URL byom-0.2.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6c0c1b2c525c08683b29363f7a4533fde7628f02b7f74f0f89652f3aaae3696
BLAKE2b-256 checksum
How to use checksums
3526df96bd1b11e7d8d92874702a623eba899f62e792ca6e243f150484c900ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 23, 2026.

Transparency log

Security for byom 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for byom-0.2.0.tar.gz

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 Nov 23, 2026.

Transparency log

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.2.0 This release

2 release files Full 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