Playground Chat Completions
Changed onRun 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.
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 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
Response
Successful Response
Changes
- info
added the optional property
to the response with the status
- info
- info
added the new optional request property
- info