Code interpreter
5 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.
Run a Python cell in a stateful context: globals persist between calls, charts come back as images#
POST
/v1/sandboxes/{id}/codescope sandboxes:writeNeeds a persistent sandbox (409 not_persistent otherwise) whose image has python3 (409 no_python). Runs through exec: a sleeping sandbox is woken first, with the same payment checks.
Parametersidrequiredpath · stringSandbox id (sbx_…)
coderequiredstringMax length 40960.
language"python"—
contextstringDefault "default"; started on first use
timeout_snumberDefault 30. Past it the cell is interrupted (TimeoutError) and the context lives on Min 0. Max 80.
200400401403404409502504
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/code \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
The sandbox's running code contexts#
GET
/v1/sandboxes/{id}/code/contextsscope sandboxes:writeNeeds a persistent sandbox (409 not_persistent otherwise) whose image has python3 (409 no_python). Runs through exec: a sleeping sandbox is woken first, with the same payment checks.
Parametersidrequiredpath · stringSandbox id (sbx_…)
200401403404409
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/code/contexts \ -H "Authorization: Bearer $KOSA8_API_KEY"
Start a context (its own globals)#
POST
/v1/sandboxes/{id}/code/contextsscope sandboxes:writeNeeds a persistent sandbox (409 not_persistent otherwise) whose image has python3 (409 no_python). Runs through exec: a sleeping sandbox is woken first, with the same payment checks.
Parametersidrequiredpath · stringSandbox id (sbx_…)
namestring—
201400401403404409
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/code/contexts \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Forget a context's globals#
POST
Parameters/v1/sandboxes/{id}/code/contexts/{name}/resetscope sandboxes:writeidrequiredpath · stringSandbox id (sbx_…)
namerequiredpath · stringContext name: 1-32 of a-z, 0-9 and -
200401403404409
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/code/contexts/$NAME/reset \ -H "Authorization: Bearer $KOSA8_API_KEY"
End a context's process#
DELETE
Parameters/v1/sandboxes/{id}/code/contexts/{name}scope sandboxes:writeidrequiredpath · stringSandbox id (sbx_…)
namerequiredpath · stringContext name: 1-32 of a-z, 0-9 and -
200401403404409
curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/$SBX/code/contexts/$NAME \ -H "Authorization: Bearer $KOSA8_API_KEY"