POST Build a Schema
/api/schema
// result appears here
POST Generate
/api/generate
// result appears here
API Reference
GET /health
Liveness check. Returns
{ "ok": true }.POST /api/schema
Converts a list of properties into a strict JSON schema suitable for OpenAI structured outputs.
| Field | Type | Notes |
|---|---|---|
name | string | Optional. Schema name. Default response_schema. |
properties | array | Required. Each item is a string (defaults to type string) or an object: { name, type?, description?, enum?, items?, required? }. |
Returns
{ name, schema }. schema.additionalProperties is always false; every property is listed in required. Properties with required: false are made nullable (type: [T, "null"]) — OpenAI strict mode requires every key in required.POST /api/generate
Calls
gpt-4o-mini with a JSON-schema constrained response.| Field | Type | Notes |
|---|---|---|
prompt | string | Required. User message. |
systemPrompt | string | Optional. |
schema | object | Optional. JSON schema (the inner schema from /api/schema). Defaults to { response, explanation }. |
schemaName | string | Optional. Default response_schema. |
Returns
{ data, usage } where data is the parsed JSON object matching the schema.cURL examples
curl -sX POST https://agility.codenlighten.org/api/schema \
-H 'content-type: application/json' \
-d '{"name":"person","properties":["first_name","last_name","age"]}'
curl -sX POST https://agility.codenlighten.org/api/generate \
-H 'content-type: application/json' \
-d '{"prompt":"What is the capital of France?"}'