playground

Playground Chat Completions

Changed on

Run one chat completion for the signed-in caller.

Streaming and non-streaming both, identically to POST /api/v1/chat/completions: this resolves the principal and then calls the very same handler. The request is billed to the caller's own attribution user in the workspace they named (or their organization's default), against that user's budget, and writes the ordinary usage row with no api_key_id, because there was no key.

The body is ChatCompletionRequest unchanged, so the page sends the same request an SDK would and a model, tool or parameter the gateway gains is available here the day it lands. The workspace rides in the query string rather than in the body for that reason: a field added to the body would also have to be added to the pipeline's strip list, and a gateway-internal field that is not stripped is forwarded to the provider as a call kwarg.

user in the body is the one field the pipeline will not read here: spend binds to the session's own attribution user, derived and never accepted.

On a hosted control plane there is no local pipeline to call, so the same principal is forwarded to the data-plane gateway instead (:func:_dispatch_to_data_plane). The request and the response are the same either way.

post/api/v1/playground/chat/completions

Request

  • The document declares no server URL.
  • Auth: one of:
    • API key in header Otari-Key
    • API key in header x-api-key

Query parameters

workspace_idstring uuid nullable

Workspace to act in. Defaults to the caller's organization's default workspace. A workspace the caller is not a member of answers 404, as a nonexistent one does.

Request body

frequency_penaltynumber nullable
logit_biasobject nullable
logprobsboolean nullable
max_completion_tokensinteger nullable

Upper bound on generated tokens. OpenAI's current name for the cap max_tokens used to carry; either field is accepted, and this one wins when a request sends both.

max_tokensinteger nullable
max_tool_iterationsinteger nullable
mcp_server_idsstring[] nullable
messagesobject[] required
metadataobject nullable

Tags for cost attribution, recorded on the request's usage rows and filterable in the usage API: up to 16 string pairs, keys up to 64 characters and values up to 512. A null value is ignored. LiteLLM's nested spend_logs_metadata object is also read, and wins over a flat key of the same name; it is never forwarded to the provider.

modelstring required
ninteger nullable
parallel_tool_callsboolean nullable
presence_penaltynumber nullable
prompt_cache_keystring nullable
reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto' nullable
response_formatobject nullable
seedinteger nullable
service_tierstring nullable
session_labelstring nullable

Optional caller-supplied label for cost attribution (per run, experiment, or conversation). In hybrid mode it is forwarded onto the platform usage report so spend can be sliced by session without standing up OpenTelemetry. Stripped before the request is forwarded upstream to the provider. Has no effect in standalone mode, where there is no platform to report it to.

streamboolean
stream_optionsobject nullable
temperaturenumber nullable
tools_headerstring nullable

Optional override for the lead-in that the gateway prepends before the per-tool hint block in the system message. Useful for expressing global tool-selection policy (e.g. 'prefer MCP tools over code_execution'). Falls back to OTARI_TOOLS_HEADER env, then to the built-in default.

top_logprobsinteger nullable
top_pnumber nullable
userstring nullable

Response

Successful Response

unknown required

Changes