1. Generate
Pyth-On API
  • Auth
    • Register a new user
      POST
    • Login
      POST
    • Verify token
      POST
    • Refresh token
      POST
  • Execute
    • Execute code
      POST
  • Secrets
    • Create or update a secret
      PUT
    • Delete a secret
      DELETE
    • List all secrets
      GET
  • Audit
    • Get audit log
      GET
  • System
    • Health check
      GET
    • API info
      GET
  • Generate
    • AI generate and execute code
      POST
  • Packages
    • List persistent packages
      GET
    • Set package list
      PUT
    • Add a single package
      POST
    • Remove a package
      DELETE
  • Zero-Knowledge
    • Client encryption helper
      POST
    • Store encrypted code
      PUT
    • Delete encrypted code
      DELETE
    • List encrypted code
      GET
    • Decrypt and execute in sandbox
      POST
  • Schemas
    • AuthRequest
    • AuthResponse
    • UserInfo
    • ExecuteRequest
    • ExecuteResponse
    • SecretInput
    • GenerateRequest
    • SecretMetadata
    • GenerateResponse
    • AuditEntry
    • PackageInfo
    • EncryptedCodeMetadata
    • ZKPayload
    • HealthResponse
    • Error
  1. Generate

AI generate and execute code

POST
/api/v1/generate
Send a natural language prompt. Claude AI generates production-ready code and optionally executes it in a sandbox.
The AI is aware of your stored secret names (not values) and can generate code that references them via environment variables.
Flow: Prompt -> Claude generates code -> (optional) execute in sandbox -> return code + results
Requires: ANTHROPIC_API_KEY configured on the server.

Request

Authorization
API Key
Add parameter in header
x-api-key
Example:
x-api-key: ********************
or
JWT Bearer
Add the parameter
Authorization
to Headers
Example:
Authorization: ********************
or
Body Params application/jsonRequired

Examples

Responses

🟢200
application/json
Code generated (and optionally executed)
Body

🔴503
🟠400BadRequest
🟠401Unauthorized
🟠429RateLimited
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST '/api/v1/generate' \
--header 'x-api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "Scrape the top 5 Hacker News stories and return them as JSON",
    "language": "python",
    "execute": true
}'
Response Response Example
200 - Generated and executed
{
    "code": "import requests\nfrom bs4 import BeautifulSoup\n...",
    "language": "python",
    "packages": [
        "requests",
        "beautifulsoup4"
    ],
    "model": "claude-sonnet-4-6-20250514",
    "output": "1. Show HN: ...\n2. ...",
    "error": "",
    "exitCode": 0
}
Modified at 2026-04-04 08:23:21
Previous
API info
Next
List persistent packages
Built with