Start here

Two reading paths through the Cruxy API: the whole API in nine pages, and building an agent with tools, structured output, memory, and rules.

There are two paths here. Each step names one page and what you take from it. The pages build on each other, so read a path in order the first time; after that, each page stands on its own as a reference.

  • The API in nine pages goes from your first call to running in production.
  • Build an agent is for when the model has to act: call your functions, return data your code can parse, and remember.

The API in nine pages

  1. Make your first call

    Quickstart takes you from an empty terminal to your first model response: you get an API key with device login, then send a chat request to the canto tier.

  2. Choose a tier

    Choosing a tier compares the tiers you pass as model (canto, saga, and epos) by profile, output cap, and how each one reasons by default, and shows how to read the live catalog from GET /api/v1/models instead of hardcoding it.

  3. Hold a conversation

    Chat documents POST /api/v1/chat, the OpenAI-compatible chat completion: the request options, a single JSON completion or a Server-Sent Events stream, the cruxy block, and usage.

  4. Let the model call your functions

    Tutorial: build a tool-using agent builds on the same endpoint. You describe two functions, run the calls the model returns, send the results back, and loop on finish_reason until the model answers.

  5. Answer from your own documents

    Retrieval-augmented generation is a cookbook recipe that chains three endpoints: embeddings for a first-pass search, rerank to sharpen the shortlist, and chat to write the answer.

  6. Screen content

    Moderations checks text against the content-safety categories with the cruxy-guard model and returns an overall flagged result.

  7. Handle failures

    Errors and retries defines the error envelope, lists every error code, and says which failures to retry and how long to wait, so your client branches on the stable code, never on the wording of the message.

  8. Run it reliably

    Reliability puts the production rules in one place: the per-tier deadlines, which failures to retry, Idempotency-Key, how to tell a finished stream from a failed one, and where to check platform status.

  9. Know the limits

    Known limitations lists what the API does not do today, such as reporting a reasoning-token count or running a non-streaming call past 90 seconds, and the workaround for each.

Build an agent

An agent is a loop: the model asks for a function call, your code runs it and sends the result back, and the model continues until it has an answer. This path assumes you have made a chat call; if not, start with the first three steps above.

  1. Describe your functions

    Define tools shows how to describe each function in the tools array with a JSON Schema for its arguments, how tool_choice controls when the model calls one, and why tools are billed as input.

  2. Run the calls the model returns

    Handle tool calls covers the other half: read the tool calls on the response, run each function, send every result back by tool_call_id, and repeat until finish_reason is stop.

  3. Put the loop together

    Tutorial: build a tool-using agent builds a working TypeScript agent from those two pages: two tools, their handlers, and the loop on finish_reason, with the reasons the loop is shaped the way it is.

  4. Get answers your code can parse

    Ask for structured output explains response_format: send a JSON schema to constrain the output, read which tiers support it from GET /api/v1/models, and handle output that does not match.

  5. Let the agent remember

    Memory lets chat recall stored facts and capture new ones. It is off for a developer API key until a request opts in, so read Opt in from a developer key before you rely on it.

  6. Give it standing instructions

    Standing rules injects your organization's rules into chat as defaults. Like memory, rules are off for a developer key unless you opt in, per request or once on the key.

  7. Make the loop survive failures

    Reliability matters more in a loop, where one failed request stalls the whole task: the per-tier deadlines, which failures to retry, Idempotency-Key, and how to tell a finished stream from a failed one.

Next steps

Cookbook has more recipes that combine endpoints to finish a real job, and API Reference lists every endpoint with its exact request and response shape.

Working from a terminal instead? Get started with the CLI installs Cruxy Code, the cruxy coding agent, and signs it in with the same device login.

Moving code that already calls OpenAI? Migrate from OpenAI changes the base URL, the key, and model, and OpenAI SDK compatibility says what carries over.

Was this page helpful?