Deploy Deploy and serve

Deploy and serve

Turn a checkpoint into a dedicated, autoscaling endpoint that speaks the OpenAI API.

Dedicated deployments are enabled per account during the preview: contact sales to turn them on. Until then, deployment calls return NOT_ENABLED; you can still chat with a saved checkpoint using client.chat_complete(checkpoint=...).

Save an inference checkpoint

Deployments serve checkpoints saved with mode="inference".

checkpoint = model.save_weights("support-v1", mode="inference")

Create a deployment

create_deployment() starts replicas and returns the base URL and model name to call.

deploy.py
deployment = client.create_deployment(
    checkpoint=checkpoint,
    unified_replicas=1,
    wait=True,
)
print(deployment.base_url, deployment.model)

Call it

Use any OpenAI-compatible client.

serve.py
inference = OpenAI(
    base_url=deployment.base_url,
    api_key=os.environ["RSI_API_KEY"],
)
resp = inference.chat.completions.create(
    model=deployment.model,
    messages=[{"role": "user", "content": "Where is my order?"}],
)

Scale and monitor

Set the number of replicas with scale_on_target() (0 stops serving but keeps the deployment) and check replica hours with get_deployment_usage(). To serve a newer checkpoint behind the same URL, use client.promote().

usage = client.get_deployment_usage("dep_7Hq2")
client.scale_on_target("dep_7Hq2", replicas=3)

Clean up

Delete deployments you no longer need with delete_deployment(). Your checkpoint stays in your Cell.

Next steps