export const id = 'myvendor';
export const label = 'My Vendor';
export const defaultModel = 'my-current-model'; // pick a CURRENT id
export const models = ['my-current-model', '…'];
export const signupUrl = 'https://myvendor.example/keys';
export const needsBaseUrl = false; // true if the endpoint needs a base URL
export async function* stream({ apiKey, model, baseUrl, system, messages, signal }) {
// Translate `system` + `messages` (canonical content blocks, incl. images)
// into the vendor's request, call its streaming API, and YIELD text chunks.
const res = await fetch(`${baseUrl || 'https://api.myvendor.example'}/v1/chat`, {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}`, 'content-type': 'application/json' },
body: JSON.stringify({ model, stream: true, /* …translated messages… */ }),
signal,
});
// …parse the stream and `yield` each text delta…
}
// Optional, if the vendor supports it:
// export async function generateImage({ apiKey, model, prompt, size }) { … }