Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

Stream a playground run

POST
/api/v1/projects/{project}/playground/runs
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.

project
required
string

Project UUID, URL-encoded org-slug/project-slug, or current.

Media typeapplication/json

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
connection_id
required

LLM connection of the caller’s org to call.

string format: uuid
messages
required

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.

Array<object>
object
model
required

Provider model id: 1 to 256 bytes, with no whitespace, control character, /, \, %, ? or #.

string
params

Sampling parameters and the completion cap. Default: none.

object
frequency_penalty

OpenAI and Gemini.

number format: double
max_tokens

Completion cap, including reasoning tokens. From 1 to 65 536. Default 4 096.

integer format: int32
presence_penalty

OpenAI and Gemini.

number format: double
reasoning_effort

OpenAI only, sent as given.

string
seed

OpenAI and Gemini.

integer format: int64
stop

Stop sequences. Default: none.

Array<string>
temperature

Sampling temperature.

number format: double
top_p

Nucleus sampling.

number format: double
placeholders

Messages that replace the placeholder entries of messages, by name. Default: none.

object
render_variables

When false, the messages are sent as written; placeholders are still expanded (D-V-38). Default: true.

boolean
response_format

The schema the answer must match. The answer is streamed as text events.

object
name
required

Schema name. [A-Za-z0-9_-], 1 to 64 characters.

string
schema
required
object
key
additional properties
any
strict

Strict schema adherence where the provider supports it. Default: false.

boolean
source

Where the messages came from: a prompt version or a span. Recorded on the run’s trace.

One of:

A prompt version: {"prompt": {"name": "...", "version": 2}}.

object
prompt
required

A prompt version: {"prompt": {"name": "...", "version": 2}}.

object
name
required

Prompt name.

string
version
required

Prompt version number.

integer format: int64
tool_choice

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.

string
tools

Tools the model may call. A tool is never run. Default: none.

Array<object>

A tool the model may call.

object
description

What the tool does. Default: none.

string
name
required

[A-Za-z0-9_-], 1 to 64 characters, unique within the request.

string
parameters
required
object
key
additional properties
any
variables

Values of the {{name}} variables in the text parts of messages. Default: none.

object
key
additional properties
string

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"
}
}

The run’s events, as text/event-stream.

Media typetext/event-stream
string

The request is malformed or a filter is invalid.

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}

No credentials, or the credentials are invalid.

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}

The credentials do not allow this operation, or the organization’s plan does not include it (code plan_required).

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}

The resource does not exist.

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}

The request body is larger than the limit.

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}

Too many requests.

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}

The server is busy or a dependency is unavailable. Retry later.

Media typeapplication/problem+json

RFC 7807 problem document.

Spec 09 § Conventions.

object
code
required

Machine-readable error code.

string
Allowed values: bad_request invalid_filter query_failed query_timeout query_too_large too_many_traces too_many_items busy restore_mode unauthorized forbidden sso_required email_not_verified plan_limit plan_required scim_managed owner_not_allowed not_found method_not_allowed payload_too_large unsupported_media_type range_not_satisfiable conflict authorization_pending slow_down access_denied expired_token quota_exceeded rate_limited internal
detail

Extra explanation. Omitted when absent.

string
errors

Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.

Array<object>

One field that failed validation.

Spec 09 § Conventions.

object
field
required

Request field, query parameter, or expression the error refers to.

string
message
required

What is wrong with the field.

string
position

Location inside the field value, for filter and SQL errors.

object
column
required

1-based column number, in characters.

integer format: int32
line
required

1-based line number, in characters.

integer format: int32
status
required

HTTP status code.

integer format: int32
title
required

Short human-readable summary, the reason phrase of status.

string
type
required

Problem type URI. Always about:blank in this version.

string

Example

{
"code": "bad_request"
}