Menu: Collections

API builder

Collections

Group AI endpoints into a collection, edit drafts, test them and publish versions.

A collection is a set of related endpoints in a project, published together. A collection support in project acme with an endpoint classify-ticket is called at:

POST https://www.scalaix.com/acme/support/classify-ticket

Endpoints

An endpoint is one AI operation. Its definition holds everything the gateway needs to run it:

{
  "slug": "classify-ticket",
  "name": "Classify ticket",
  "description": "Sorts a support ticket into a category and priority.",
  "model": "gpt-4o-mini",
  "params": { "temperature": 0.2, "max_tokens": 800, "top_p": null },
  "system": "You are a support triage assistant. Answer in {{language}}.",
  "prompt": "Classify this ticket:\n{{ticket.subject}}\n\n{{ticket.body}}",
  "variables": [
    {
      "key": "ticket", "label": "Ticket", "type": "object", "required": true,
      "properties": [
        { "key": "subject", "label": "Subject", "type": "string", "required": true },
        { "key": "body", "label": "Body", "type": "string", "required": true }
      ]
    },
    { "key": "language", "label": "Language", "type": "enum", "enum": ["English", "Spanish"],
      "required": false, "default": "English" }
  ],
  "output": {
    "format": "json",
    "schema": {
      "type": "object",
      "properties": {
        "category": { "type": "string", "enum": ["billing", "bug", "other"] },
        "priority": { "type": "integer", "description": "1 (low) to 5 (urgent)" },
        "tags": { "type": "array", "items": { "type": "string" } }
      },
      "required": ["category", "priority"]
    },
    "csv_columns": null,
    "xml_template": null,
    "language": null
  },
  "cache": { "enabled": false, "ttl_seconds": 86400, "variants": 1 },
  "fallback": ["claude-3-5-haiku-latest"],
  "variations": 1
}
FieldNotes
slugLowercase letters, digits and -, up to 63 characters, unique in the collection.
modelA catalog model id, or auto to use the project's routing.
paramstemperature 0 to 2, max_tokens 1 to the model's maximum, top_p. null uses the provider default.
system, promptTemplates. See Variables and templates.
variablesThe typed inputs callers send.
outputjson (with a schema), text, csv (with columns) or xml (with an example template). See Output schemas. language asks for answers in one language.
cacheSee Caching.
fallbackModels tried in order when the model fails.
variations1 to 5 answers per call. With more than one, data is an array.

Creating endpoints

New endpoint has two ways to start. Describe it (the default): write what the endpoint should do and Scalaix drafts the inputs, output schema and prompt, which you review and edit before anything is created. See Create an endpoint from a description. Start blank creates an endpoint from a name, with one string input and a one-field output to build on.

Drafts and tests

What you edit in the console is a draft. Saving checks the definition: formats, unique slugs and keys, that every {{name}} is a declared variable, that the model exists, parameter ranges and the output schema. Problems are listed by path (variables[1].key).

The Test panel runs the current draft through the gateway with inputs you type, against the endpoint's model or another one. It shows the parsed output, the rendered system prompt and prompt, the model that answered, tokens, cost and latency. Tests are never cached and appear in usage with kind test.

Test inputs can use environments, the project's named sets of variables, as {{env.key}}: pick one at the top of the panel and the panel shows what the inputs resolve to. Save as test case keeps the inputs, with checks on the answer (status, field values, patterns, ranges, latency, cost), and opens them in the developer pane under Test data → Test cases. The gear next to the environment picker opens Test data → Environments.

Test cases and the runner

Each endpoint has saved test cases, like saved requests in a Postman collection. They live in the developer pane (Ctrl + `) under Test data: run one, load it back into the Test panel, edit its checks, or reorder them. Runs runs an endpoint's cases or the whole collection (Run all test cases on the Endpoints tab opens it), against the draft or a published version, with each case's environment or one for all. See Test with environments and saved cases.

Publishing

Publishing freezes every endpoint in the collection into a new numbered version. See Publishing and versions.