in src/requests/request.ts [114:132]
export async function constructModelRequest(
model: string,
task: Task,
apiKey: string,
stream: boolean,
body: string,
requestOptions: SingleRequestOptions,
): Promise<{ url: string; fetchOptions: RequestInit }> {
const url = new RequestUrl(model, task, apiKey, stream, requestOptions);
return {
url: url.toString(),
fetchOptions: {
...buildFetchOptions(requestOptions),
method: "POST",
headers: await getHeaders(url),
body,
},
};
}