API reference · Models
Mint a short-lived playground token for the inference API (signed-in users only)
/v1/playground-tokensReturns a bearer token that calls the inference API on behalf of the signed-in user in this project, for trying models from the console. It expires after ttl_seconds (15 minutes by default) and is shown only in this response. API keys cannot mint one.
Console session only. The console calls this with a signed-in session; API keys are refused. Requires the inference:invoke permission (a key's scope, or a role that includes it).
Request
| Header | Required | Description |
|---|---|---|
X-Project-Id | yes | The project to act in, for console sessions. Requests with an API key leave it out. |
Idempotency-Key | no | Makes a retry safe: the same key and request within 24 hours return the original response (see Idempotency). The SDKs send one for you. |
Body
JSON (application/json): CreatePlaygroundTokenRequest.
ttl_secondsintegerLifetime in seconds (30–900, default 900)
30–900
Response
201 PlaygroundToken — The token (shown once)
objectstringrequiredAlways `playground_token`: the type of this object
One of
playground_tokenidstringrequiredUnique ID (`pgt_…`)
ID with prefix pgt_
project_idstringrequiredProject it belongs to
ID with prefix prj_
tokenstringrequiredBearer token for the inference API. Short-lived; never store it.
expires_atstring (date-time)requiredWhen it expires (null: never) (ISO 8601, UTC)
Example response
{
"object": "playground_token",
"id": "pgt_01jc5zq4m8k3v6x9t2w7r0b1e4",
"project_id": "prj_01jc5zq4m8k3v6x9t2w7r0b1e4",
"token": "pg_eyJ2IjoxLC…",
"expires_at": "2026-01-01T00:00:00.000Z"
}Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
409 | conflict_error idempotency_in_progress | A request with the same Idempotency-Key is still running. |
422 | idempotency_error idempotency_key_reused | The Idempotency-Key was used with a different request. |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |