Skip to content

llm.generate

Schema

Input = {
prompt: string,
system?: string,
tier?: 'cheap' | 'standard' | 'strong' | 'image' | 'embed', // default 'cheap'
temperature?: number, // 0-2
maxTokens?: number, // 1-32000
}
Output = {
text: string,
model: string,
costUsd: number,
promptTokens: number,
completionTokens: number,
}

The thinnest possible skill: it’s a direct pass-through to ctx.llm.complete() — see Models and the budget guards for tier meanings, fallback models, and the spend guards this call is checked against before it goes out. Every real cost and token count is returned so a caller (or a trace) can account for exactly what this one call spent, same as any other model call in the system — nothing here bypasses llm_calls logging or the budget check.

Example

Terminal window
curl -s -X POST http://localhost:4000/api/studio/skills/invoke \
-H 'content-type: application/json' -b cookies.txt \
-d '{"name":"llm.generate","input":{"prompt":"Three taglines for a coffee subscription, under 8 words each.","tier":"cheap"}}'
{
"ok": true,
"output": {
"text": "1. Your week, one good cup at a time.\n2. Coffee that shows up before you do.\n3. Fresh roast, no errands.",
"model": "google/gemini-2.5-flash-lite",
"costUsd": 0.00004,
"promptTokens": 28,
"completionTokens": 31
}
}