Workbox
  • Who it's for
  • Models
  • How it runs
  • Join an event
  • Docs
Sign inGet started
  • Who it's for
  • Models
  • How it runs
  • Join an event
  • Docs
  • Sign in

Docs

  • Getting started
  • Boxes
  • SSH into a box
  • CLI
  • The job settings
  • Metrics and samples
  • Serve your model
  • Deploy a model
  • The management API
  • Box templates
  • Environments and events
Workbox

The cloud for AI workloads.

Product

  • Who it's for
  • Models
  • How it runs
  • Docs

Events

  • Join an event
  • Run a workshop

© Workbox

Deploy a model

Deployments, API keys and the OpenAI API for your apps.

A deployment serves a model for your apps. It belongs to the workspace, not to you, and runs on as many replicas as its traffic needs, down to none when nobody calls it.

Deploy a model

On a model's page, Deploy (or its Deployments tab): give it a name (it is the API's model), a size, and how many replicas. Or from your terminal:

workbox deploy tiny-shakespeare-12 --name shakespeare --min 0 --max 3
SettingWhat it does
SizeThe GPU each replica runs on: the model's size, unless you choose
Fewest replicas0 lets it scale to none when quiet. The next request then waits while a replica starts
Most replicasThe most it scales up to
Requests per replicaOpen requests a replica takes before another starts
Idle minutesWith no requests for this long, it goes down to its fewest replicas
Browser originsWeb pages on these origins may call it. None by default: keys belong on servers

Roll out another model (a newer job's, or a fine-tune) from its page's Deployments tab, with no downtime: its replicas start, requests move to them once one is ready, and the old ones finish what they're answering. Roll back to an earlier revision the same way. Pause stops its replicas; Delete ends it.

A project can roll out the model of every successful push by itself:

deploy:
  name: shakespeare
  replicas: { min: 0, max: 3 }

Replicas count in the workspace's spending like boxes. At its monthly cap a deployment stops scaling up and new requests are refused with insufficient_quota; whoever made it is told.

Call it

Make a key in Settings, API keys (owners and admins). It is shown once. Then use any OpenAI SDK, changing only the base URL and the key:

from openai import OpenAI

client = OpenAI(base_url="https://<models address>/v1", api_key="wbx_live_...")
stream = client.chat.completions.create(
    model="shakespeare",
    messages=[{"role": "user", "content": "Write a sonnet."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Every deployment is called at the same base URL, like https://workbox.fyi/v1, with its name as model. The Deployments tab shows the base URL and ready-to-copy curl, Python and JavaScript.

Endpoint
GET /v1/modelsThe deployments your key may call
POST /v1/chat/completionsChat, streamed or not
POST /v1/completionsText completion
POST /v1/embeddingsWhere the engine has it

Keys and limits

A key may call every deployment or the ones you choose, and may also manage deployments (the API). Each can have its own limit of requests and tokens a minute, and an expiry. Revoking one takes effect within seconds.

Errors

Errors are in OpenAI's shape, {"error": {"message", "type", "code"}}:

StatusCodeMeans
401invalid_api_keyThe key is wrong, revoked or expired
403model_not_allowedThe key may not call that deployment, or a browser's origin isn't listed
404model_not_foundNo deployment by that name in the key's workspace
413request_too_largeThe body is over 10 MB
429rate_limit_exceededThe key's limit for this minute is used; Retry-After says when to try again
429insufficient_quotaThe workspace has reached its spending cap
503model_startingNo replica was ready in time; try again shortly

Next: The management API

Sign inGet started