> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trajectory.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Download a checkpoint

> Private beta: download a checkpoint's LoRA adapter or merged model.

> [!NOTE]
>
> Private beta. Your organization needs access; otherwise these calls return 403 `beta_not_enabled`. Contact Trajectory to request it. These helpers may change in a minor release. Requires `trajectory-sdk` 0.10.11 or later.

Download a [checkpoint](https://docs.trajectory.ai/guides/training.md) to use its weights outside Trajectory. You can download its LoRA adapter, or for supported base models, the full model merged with its base.

## Download with the SDK

```python theme={null}
from trajectory import Client
from trajectory.lib.beta import download_checkpoint

client = Client()
checkpoints = client.training.checkpoints.list("YOUR_TRAINING_RUN_ID")
checkpoint = max(checkpoints, key=lambda c: c.step_index)

path = download_checkpoint(client, checkpoint.checkpoint_id, "models/")
print(path)  # models/<checkpoint_id>/
```

The first request for a checkpoint prepares its export, which can take several minutes for a large adapter. Later requests reuse it. The directory holds the adapter files and `manifest.json`.

| Argument | Default | Behavior |
| - | - | - |
| `output_dir` | `.` | Parent directory for `<checkpoint_id>/`. |
| `overwrite` | `False` | Replace an existing target. Otherwise `FileExistsError` is raised before any request. |
| `timeout` | `3600` | Seconds to wait for the export to be ready. `None` waits indefinitely. |
| `poll_interval` | `5` | Seconds between status checks. |
| `http_client` | New client | Your own `httpx2.Client` for the download. |

A failed call leaves nothing behind and starts over the next time. Downloads do not resume.

## Download from the platform

Open the training run, select a checkpoint, and choose **Download weights**. The button appears for deployable checkpoints when your organization has access.

## Use the download link yourself

`wait_for_checkpoint_export` returns the ready export with a signed link, without downloading anything:

```python theme={null}
from trajectory.lib.beta import wait_for_checkpoint_export

export = wait_for_checkpoint_export(client, "YOUR_CHECKPOINT_ID")
print(export.download.url, export.download.size_bytes, export.download.url_expires_at)
```

The link lasts one hour. `client.beta.checkpoint_exports.retrieve(export.export_id)` returns a new one. `client.beta.checkpoint_exports` also has `create` and `list`, and sends the beta opt-in header for you.

## Handle errors

| Error | Meaning | What to do |
| - | - | - |
| `trajectory.lib.beta.CheckpointExportError` | The export failed or has no download link. The error's `export` attribute holds it. | Call again to retry. |
| `TimeoutError` | The wait ended first. The server keeps preparing the export. | Call again to pick it up. |
| `zipfile.BadZipFile` | The downloaded ZIP is corrupt. | Call again to download it again. |
| 403 `beta_not_enabled` | Your organization doesn't have access. | Contact Trajectory. |
| 409 | This checkpoint can't be downloaded. | Only Tinker checkpoints are supported. |

## Download a merged model

A merged model is the base model with the adapter merged in, stored as a Hugging Face folder of files. Merged exports work like a batch job: queue the export, poll it, and pull it down once it's ready. Merging can take hours, and a model can be hundreds of gigabytes, so nothing here needs a process that stays open. Your organization needs merged exports enabled separately.

```python theme={null}
from trajectory import Client
from trajectory.lib.beta import download_merged_export

client = Client()

# Queue it; this returns right away, and repeat calls reuse the same export
export = client.beta.checkpoint_exports.create(
  "YOUR_CHECKPOINT_ID", body={"export_type": "merged_model", "precision": "bf16"}
)

# Poll later, even from another process or machine
export = client.beta.checkpoint_exports.retrieve(export.export_id)

# Pull it down once it's ready
if export.state == "ready":
  path = download_merged_export(client, export.export_id, "models/")
  print(path)  # models/<checkpoint_id>-merged-bf16/
```

There's no webhook, and a queued export can't be cancelled.

`download_merged_export` downloads files in parallel and checks each against its MD5. If a call fails, for example because a link expired during a long download, call it again: files it finished stay in a hidden `.<name>.partial` folder next to the target, and the next call downloads only the rest with fresh links.

| Argument | Default | Behavior |
| - | - | - |
| `output_dir` | `.` | Parent directory for the model folder. |
| `overwrite` | `False` | Replace an existing target. Otherwise `FileExistsError` is raised before any file request. |
| `max_workers` | `8` | Files downloaded at once. |

### Supported models

`client.beta.checkpoint_exports.list(checkpoint_id).available_merge_precisions` lists the formats a checkpoint can use, with each one's size and known limits.

| Base model | Precision | Merged size |
| - | - | - |
| `Qwen/Qwen3.5-4B` | `bf16` | 9.3 GB |

Exports expire after 28 days. A retrieved export then reports `failed`, and queueing it again rebuilds it.

### Merged export errors

| Error | Meaning | What to do |
| - | - | - |
| `CheckpointExportError` | The export isn't a ready merged export. The error's `export` attribute holds it. | Check its state. |
| `ValueError` | A file failed its MD5 check and wasn't kept. | Call again to fetch it. |
| `requests.HTTPError` or `requests.ConnectionError` | A file failed to download, or its link expired. | Call again; finished files are kept. |
| 409 | This base model or precision isn't available, or your organization doesn't have merged exports. | Check the supported models. |

Evaluate a merged model on your own serving stack before relying on it, because merging can reduce accuracy, especially at low precision.

## Build a full model yourself

For other base models, merging the adapter happens on your side. Tinker's [merge guide](https://tinker-docs.thinkingmachines.ai/cookbook/deployment/export-hf/) covers how, and its supported models are listed in the [Cookbook](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/weights/README.md). Evaluate the result on your own serving stack, because merging can reduce accuracy, especially at low precision.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.