Agility JSON Server

Structured output from gpt-4o-mini with auto-generated JSON schemas.

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.
FieldTypeNotes
namestringOptional. Schema name. Default response_schema.
propertiesarrayRequired. 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.
FieldTypeNotes
promptstringRequired. User message.
systemPromptstringOptional.
schemaobjectOptional. JSON schema (the inner schema from /api/schema). Defaults to { response, explanation }.
schemaNamestringOptional. 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?"}'