Models
Lets a Mini App use the AI models already set up in Cowork. API keys stay inside Cowork and never reach the page. Each call is one request and one reply: no tools, no chat history.
MAESTROSDK.llm.providers() Not yet released
Lists the model providers that are ready to use (signed in or with a key), with their models and reasoning efforts.
Parameters
None.
Returns
Promise<Provider[]>. An empty list when nothing is set up, when the page has no Cowork tab identity, or when the call fails.
| Field | Type | Description |
|---|---|---|
id | string | Provider id, passed to complete as provider |
label | string | Name to show |
models[].id | string | Model id, passed as model |
models[].label | string | Name to show |
models[].defaultEffort | string | The effort Cowork uses by default |
models[].efforts[] | { id, label }[] | Efforts this model accepts; pass an id as effort |
Example
js
const providers = await MAESTROSDK.llm.providers();
const first = providers[0]?.models[0];MAESTROSDK.llm.complete(request) Not yet released
Sends one prompt to one model and returns its text reply.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
request.provider | string | Yes | A provider id from providers() |
request.model | string | Yes | A model id of that provider |
request.effort | string | Yes | An effort id of that model |
request.prompt | string | Yes | The prompt, at most 32,000 characters |
One call waits at most 120 seconds for the model.
Returns
Promise<{ ok: true, text: string } | { ok: false, error: string }>
Errors
error | Meaning |
|---|---|
provider, model, effort and prompt are required | A field is missing or empty |
prompt_too_long | The prompt is over 32,000 characters |
empty_prompt | The prompt is only spaces |
unknown_model | The combination is not in providers() |
empty_reply | The model returned no text |
no_instance | The page has no Cowork tab identity |
host_unavailable | Cowork could not take the call |
| Any other text | The model's own error message, or model_failed |
Example
js
const [provider] = await MAESTROSDK.llm.providers();
const model = provider.models[0];
const reply = await MAESTROSDK.llm.complete({
provider: provider.id,
model: model.id,
effort: model.defaultEffort,
prompt: 'Summarise this note in one sentence: ...'
});
if (reply.ok) show(reply.text); else showError(reply.error);Related
- Chat: Models and Reasoning Effort Where models are set up
- Overview All modules of the Mini App SDK