Safeguard Docs
API Platform (Console)

Workbench

Try models in the Console without writing code: pick a model, write a prompt, tune the settings, and read the answer with its tokens, cost and latency.

The Workbench is the Console's playground. It sends the same request your code would send to POST /chat/completions and shows the answer as it streams in, with what the run cost. Open it from the Console sidebar, or with Open workbench on the Dashboard.

The Workbench uses your Safeguard sign-in, not an API key. Its runs spend your workspace's credit at the same prices as API calls.

The screen

Left side

  • System prompt: optional instructions that set the model's behaviour. Sent as a system message.
  • Prompt: what you want to ask. Sent as a user message.
  • Run sends the request. While it runs, Stop appears.
  • Response: the answer, filling in as it streams.

Right side

  • Model: the catalog's models, starting on one you can run. A model you cannot run yet shows its state after its name, such as (Request access) or (Coming soon). When it is selected, Run stays disabled and the Workbench says why, for example "cannot run: Coming soon." If no model can run, the picker says No model can run right now. Under the picker, the model's input and output prices per million tokens, when the catalog has them.
  • Max tokens: the most the model may write. The field offers 1 to 8,192 and starts at 1,024.
  • Temperature: from 0 to 1 in steps of 0.1. The default is 1.

After a run

Below the response, the Workbench shows:

FigureMeaning
Input and OutputTokens, as the provider counted them.
CostThe run's cost in US dollars, from the gateway's usage.cost.
LatencyMilliseconds from sending the request to the last byte.
First tokenMilliseconds until the first text arrived.
Request IDThe run's id, gen- and 32 hexadecimal characters, with a copy button. Quote it when you ask Safeguard about a run.

Two notes can appear: Token counts are estimates: the server sent no usage. and Stopped at the max tokens limit., when the model used every token you allowed.

Each run also appears in Usage: in the request log and under By key, as Console workbench, because no key was used.

When a run fails

The Workbench shows the error with one next step:

ProblemWhat you see
Not enough creditThe message, and Add credit when card top-up is available.
A monthly spend limit reachedThe message and Open limits, which goes to the limits on Usage.
Too many runsSlow down, with a countdown from the Retry-After header.
Model not availableThe message, asking you to pick another model.

When the request reached a provider before it failed, the error also shows its Request ID. The Errors page lists every code.

Stop

Stop ends the stream in your browser. The provider is not stopped: the gateway keeps reading its answer to the end so that it can bill the provider's own token counts, and the run is billed for everything the provider generated. Lower Max tokens to limit what a run can cost.

Limits that apply

  • Runs spend the workspace's prepaid credit and count toward the workspace's monthly spend limit. No key limit applies, because no key is used.
  • Each person can start up to 60 runs a minute.
  • A support session that is read-only cannot run requests.

Before the API Platform is on

Until Safeguard turns the API Platform on for your workspace, the Workbench lists two placeholder models, and Run answers that the inference endpoint is not connected yet. No request reaches a model.

Your own models

The Workbench's model list shows catalog models only. Models your workspace added itself cannot be picked in this version. See Bring your own model.

Chat, Compare and Code

Where Safeguard has switched on the new Workbench for your workspace, it has three modes and a code panel:

  • Prompt: one prompt, one answer, as above.
  • Chat: a multi-turn conversation; each message sends the whole conversation so far.
  • Compare: one prompt sent to two or three models at once, each answer streamed in its own column with its tokens, cost, latency, time to first token and generation id.
  • Code: the request you are about to run as curl, Python and Node with the OpenAI SDKs, and plain fetch, reading the key from SAFEGUARD_INFERENCE_KEY.

Where routing is switched on, Prompt and Chat also let you add fallback models and pick a sort (price, latency or uptime); the code panel includes them. Open a model straight in the Workbench with /console/workbench?model=<id>, or from Models in the Console sidebar, which lists every model with its provider, context length, prices per 1M tokens (no markup), and measured latency and uptime where there is traffic.

From the Workbench to code

A Workbench run is a chat completion with messages (the system prompt, if any, and your prompt), max_tokens, temperature, stream: true and stream_options.include_usage: true. The same request from code:

import os

from openai import OpenAI

client = OpenAI(
    base_url="https://api.safeguard.sh/gpt/v1",
    api_key=os.environ["SAFEGUARD_INFERENCE_KEY"],
)

stream = client.chat.completions.create(
    model="MODEL_ID",
    messages=[
        {"role": "system", "content": "You are a security reviewer."},
        {"role": "user", "content": "Review this dependency update plan: ..."},
    ],
    max_tokens=1024,
    temperature=1,
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")

See Streaming for the rest.

On this page