Skip to main content
Use Magica’s LLM Gateway for chat, tool calling, image understanding, and PDF analysis. Every endpoint uses the same base URL and API key:

Choose an endpoint

Every model ID advertised by the language-model catalog can be selected through any of these three endpoints. The endpoint controls the request and response format; the model controls available modalities, context and output limits, and format-specific features. All three endpoints are stateless. Send the conversation history needed for the current answer in each request.

Quickstart

stream is optional. Omit it, as below, to receive one complete JSON response.

Direct JSON or streaming

  • Omit stream or set "stream": false for one complete JSON response.
  • Set "stream": true to receive server-sent events as output is generated.
Start with direct JSON unless your interface needs to render partial output. Authentication, credit usage, model selection, and errors behave the same in both modes.

Images, PDFs, and attachments

Use a public HTTPS URL when possible. Inline base64 data increases request size and can reach a model’s request limit much sooner.
Attachment support also depends on the selected model. Use the language-model catalog to choose a model with the capabilities and context size your input needs.

Models, limits, and usage

Call GET /v1/llm/models.json for current model IDs, capabilities, context limits, request-size limits, and pricing. Successful responses include token usage. Requests that exceed the selected model’s limit return 413 rather than silently truncating history or attachments.