Skip to main content
POST https://api.prysm1.com/v2/code · Requires authentication
Code Mode writes code, reviews it with a separate critic model, and repairs against that feedback until the review passes or a budget/iteration cap is hit (Reflexion-style). In depth policy several diverse coders run in parallel and the best candidate is kept. The response carries the files, the final review verdict, and a PrysmProof v2 that binds the task to the code it produced. You pick the objective with a policy; PRYSM picks the coder and the critic (or you force them). See How Code Mode works for the full model.
This endpoint lives under /v2, not /v1. The SDKs target it automatically with client.code(...). PRYSM never executes the generated code — the default critic is a pure LLM reviewer.

Authorization

string
required
Your secret key as a bearer token: Bearer prysm_sk_...

Body

string
required
The coding task in natural language, e.g. “Write a thread-safe LRU cache in Python with tests”.
string
Target language (python, typescript, rust, …). Auto-detected from the task if omitted.
string
default:"balanced"
The objective dial: efficiency (one cheap coder), depth (cross several diverse coders in parallel and keep the best), or balanced.
string
Force the model that writes the code. Ignored if it isn’t a known catalog model.
string
Force the critic model that reviews the code. Ignored if it isn’t a known catalog model.
integer
default:"3"
Total iterations: the first generation plus up to max_iters - 1 repairs.
boolean
default:"true"
Set false for a single shot — one coder, one draft, no critic loop.
integer
default:"2048"
Maximum tokens per underlying model call.
number
default:"0.2"
Sampling temperature passed to the underlying models. Lower is steadier for code.
number
A soft budget hint, in USD. The repair loop stops early once the estimated spend approaches this cap.
boolean
default:"true"
Include the per-stage execution trace in prysm.stages. Set false for a leaner response.

Response

string
Unique code-run id, e.g. prysm-a1b2c3d4.
string
Always code.
integer
Unix timestamp (seconds).
string
The task that was solved.
string
The target language (detected or forced).
string
The policy that ran: efficiency, balanced, or depth.
string
Plain-English explanation of how the run was carried out.
boolean
Whether the final review passed.
integer
How many generate→review cycles ran.
array
The generated files.
object
The final critic verdict, or null when review was false.
object
Aggregate token usage across every model call.
object
The Code Mode extension block.

Errors