Stream a playground run
const url = 'http://localhost:8080/api/v1/projects/example/playground/runs';const options = { method: 'POST', headers: { cookie: 'cetra_session=<cetra_session>', 'Content-Type': 'application/json' }, body: '{"connection_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","messages":[{}],"model":"example","params":{"frequency_penalty":1,"max_tokens":1,"presence_penalty":1,"reasoning_effort":"example","seed":1,"stop":["example"],"temperature":1,"top_p":1},"placeholders":{},"render_variables":true,"response_format":{"name":"example","schema":{},"strict":true},"source":{"prompt":{"name":"example","version":1}},"tool_choice":"example","tools":[{"description":"example","name":"example","parameters":{}}],"variables":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/projects/example/playground/runs \ --header 'Content-Type: application/json' \ --cookie cetra_session=<cetra_session> \ --data '{ "connection_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "messages": [ {} ], "model": "example", "params": { "frequency_penalty": 1, "max_tokens": 1, "presence_penalty": 1, "reasoning_effort": "example", "seed": 1, "stop": [ "example" ], "temperature": 1, "top_p": 1 }, "placeholders": {}, "render_variables": true, "response_format": { "name": "example", "schema": {}, "strict": true }, "source": { "prompt": { "name": "example", "version": 1 } }, "tool_choice": "example", "tools": [ { "description": "example", "name": "example", "parameters": {} } ], "variables": { "additionalProperty": "example" } }'Members and above, through a session or a read-write personal access token. API keys cannot call it. Answers text/event-stream: start {trace_id}, then text {delta} and tool_call {id, name, arguments} events, then one last done {finish_reason, usage, cost_usd, latency_ms, ttft_ms, output} or error {class, message} (class retryable, pause or permanent). A ping comes every 15 seconds. A response format is answered in text events. Tools are never run. A tool named auto, none or required cannot be forced by name through tool_choice. The run is traced into the reserved environment cetra-playground, which is not billed. The connection is used whatever its status, and a failure never marks it failing.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Project UUID, URL-encoded org-slug/project-slug, or current.
Request Bodyrequired
Section titled “Request Bodyrequired”POST /api/v1/projects/{project}/playground/runs body.
Unknown fields are refused. Each messages entry is a canonical message (spec 01) or a
placeholder {"type": "placeholder", "name": ...}; a placeholder is replaced, in place, by the
messages given under its name in placeholders.
object
LLM connection of the caller’s org to call.
Canonical messages (spec 01) and placeholder entries, at least one. A text part of a
message written here is rendered with variables; a placeholder’s messages are not.
object
Provider model id: 1 to 256 bytes, with no whitespace, control character, /, \, %,
? or #.
Sampling parameters and the completion cap. Default: none.
object
OpenAI and Gemini.
Completion cap, including reasoning tokens. From 1 to 65 536. Default 4 096.
OpenAI and Gemini.
OpenAI only, sent as given.
OpenAI and Gemini.
Stop sequences. Default: none.
Sampling temperature.
Nucleus sampling.
Messages that replace the placeholder entries of messages, by name. Default: none.
object
When false, the messages are sent as written; placeholders are still expanded (D-V-38). Default: true.
The schema the answer must match. The answer is streamed as text events.
object
Schema name. [A-Za-z0-9_-], 1 to 64 characters.
object
Strict schema adherence where the provider supports it. Default: false.
Where the messages came from: a prompt version or a span. Recorded on the run’s trace.
A prompt version: {"prompt": {"name": "...", "version": 2}}.
object
A prompt version: {"prompt": {"name": "...", "version": 2}}.
object
Prompt name.
Prompt version number.
A span: {"span": {"trace_id": "...", "span_id": "..."}}.
object
A span: {"span": {"trace_id": "...", "span_id": "..."}}.
object
The span, 16 lowercase hex digits.
Trace of the span, 32 lowercase hex digits.
auto, none, required, or the name of one of tools. A tool named auto, none or
required cannot be forced by name. Default: the provider’s choice.
Tools the model may call. A tool is never run. Default: none.
A tool the model may call.
object
What the tool does. Default: none.
[A-Za-z0-9_-], 1 to 64 characters, unique within the request.
object
Values of the {{name}} variables in the text parts of messages. Default: none.
object
Example generated
{ "connection_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "messages": [ {} ], "model": "example", "params": { "frequency_penalty": 1, "max_tokens": 1, "presence_penalty": 1, "reasoning_effort": "example", "seed": 1, "stop": [ "example" ], "temperature": 1, "top_p": 1 }, "placeholders": {}, "render_variables": true, "response_format": { "name": "example", "schema": {}, "strict": true }, "source": { "prompt": { "name": "example", "version": 1 } }, "tool_choice": "example", "tools": [ { "description": "example", "name": "example", "parameters": {} } ], "variables": { "additionalProperty": "example" }}Responses
Section titled “Responses”The run’s events, as text/event-stream.
The request is malformed or a filter is invalid.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}No credentials, or the credentials are invalid.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The credentials do not allow this operation, or the organization’s plan does not include it (code plan_required).
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The resource does not exist.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The request body is larger than the limit.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}Too many requests.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The server is busy or a dependency is unavailable. Retry later.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}