Runtime
Run a code snippet
Writes code to a temp file and runs it with the chosen interpreter. Cleaner than /exec for multi-line scripts because you don't have to deal with shell escaping. Response shape matches /exec.
Supports the same stream: true opt-in as /exec; see that endpoint's description for the SSE event shape.
post/sandboxes/{id}/code
Path parameters
idstring required
24-char hex id of the sandbox.
Request body
Example request
{
"env": {
"OPENAI_API_KEY": "sk-..."
}
}Response
Code completed.
When the request body has stream: true, the response is text/event-stream, one ExecStreamFrame per data: event.
Example response
{
"message": "Exec completed"
}