Skip to main content
Use the Bread SDK for programmatic control over the baking process. Available in Python and TypeScript. Perfect for automation, integration, and advanced use cases.
Prefer a git-based workflow? Check out bgit Quickstart for a git-native interface.

Installation

# Install from PyPI
pip install aibread

# Or using uv
uv pip install aibread

# Or install from source
git clone https://github.com/Bread-Technologies/Bread-SDK-Bake-Repo.git
cd Bread-SDK-Bake-Repo
pip install -e .

Authentication

Set your API key as an environment variable:
export BREAD_API_KEY=your-api-key-here
Or use a .env file (see Authentication for details).

Your First Bake

import os
from aibread import Bread

# Initialize client
client = Bread(api_key=os.environ.get("BREAD_API_KEY"))

# Set repository
client.repo.set(repo_name="my_repo", base_model="Qwen/Qwen3-32B")

# Set prompt
client.prompts.set(
    prompt_name="yoda_teacher",
    repo_name="my_repo",
    messages=[
        {"role": "system", "content": "You are Yoda. Speak like Yoda."}
    ]
)

# Set target
client.targets.set(
    target_name="main_target",
    repo_name="my_repo",
    template="default",
    overrides={
        "generators": [
            {"type": "oneshot_qs", "model": "claude-sonnet-4-5-20250929", "numq": 100}
        ],
        "model_name": "Qwen/Qwen3-32B",
        "teacher_prompt": "yoda_teacher",
        "student_prompt": ""
    }
)

# Run stim
client.targets.stim.run(
    target_name="main_target",
    repo_name="my_repo"
)

# Run rollout
client.targets.rollout.run(
    target_name="main_target",
    repo_name="my_repo"
)

# Set bake
client.bakes.set(
    bake_name="v1",
    repo_name="my_repo",
    template="default",
    overrides={
        "datasets": [{"target": "main_target", "weight": 1.0}]
    }
)

# Run bake
client.bakes.run(bake_name="v1", repo_name="my_repo")
Method Signatures: In Python, repo_name must be passed as a keyword argument (e.g., repo_name="my_repo"). In TypeScript, it goes in the options object. This ensures API clarity and consistency across all run() methods (stim.run(), rollout.run(), bakes.run()).Automatic Polling: By default, run() methods automatically poll for completion (poll=True). Manual polling loops are no longer needed unless you explicitly set poll=False.

Next Steps