Connection
Base URL, credentials and a reachable server.
Reserve response tokens before assembling a model request. Test a prompt exactly at the remaining limit and stop when the reserve exceeds the context window.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
const availableInput = contextLimit - outputReserve;
if (inputTokens > availableInput) return reduceContext();
return sendWithinBudget();