Skip to main content
All Swytcho API requests follow a consistent structure, regardless of which model or endpoint you call. Once you understand the pattern, you can apply it to every feature the API offers — from chat completions to embeddings — without having to re-learn the basics each time.

Base URL

Every request targets the following base URL:
Append the relevant path for your operation — for example, https://api.swytcho.com/v1/chat/completions for chat completions.

Required Headers

Every request must include the headers below. Obtain your API key from the Swytcho Dashboard. Store it in an environment variable — never hard-code it in source files.

Request Body

Send a JSON body with your request. At a minimum, provide the model field and the input content (messages for chat, input for embeddings). All other fields are optional.

Key Parameters

string
required
The ID of the model to use, for example "swytcho-1" or "swytcho-1-mini". See Models for the full list of available model IDs.
integer
The maximum number of tokens to generate in the response. The request’s input tokens plus max_tokens must not exceed the model’s context window. Defaults to the model’s maximum output if omitted.
number
Controls randomness in the output. Values range from 0 (deterministic) to 2 (highly random). Use lower values for factual or structured tasks; higher values for creative tasks. Defaults to 1.
number
Nucleus sampling threshold. The model considers only the tokens whose cumulative probability mass reaches top_p. Range: 0 to 1. Defaults to 1. Swytcho recommends adjusting either temperature or top_p, but not both at the same time.
boolean
When true, the API streams partial response tokens back as server-sent events (SSE) instead of waiting for the full completion. Defaults to false. See the Streaming guide for details on consuming the event stream.

Example Request

The example below sends a chat completion request using curl. Swap in your own API key and adjust the messages array for your use case.
Swytcho enforces a default request timeout of 120 seconds. For long-form generation tasks, enable streaming ("stream": true) so you can start processing tokens immediately and avoid timeout errors on large outputs. If you are using a client library, set its timeout to at least 120 seconds to match the server-side limit.