Base URL
Every request targets the following base URL: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 themodel field and the input content (messages for chat, input for embeddings). All other fields are optional.
Key Parameters
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.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.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.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.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 usingcurl. Swap in your own API key and adjust the messages array for your use case.