fn health()
Check server health status and loaded models
fn systemInfo()
Get system information including devices, GPUs, NPUs, and supported recipes
fn systemStats()
Get current host resource usage statistics
fn stats()
Get performance statistics from the last inference request (tokens, latency)
fn sync()
Sync local model data with the Lemonade Server — fetches models list and health status
fn modelsList()
List all available models registered with the Lemonade Server
fn modelsLoaded()
List models currently loaded in memory with recipe and device details
fn modelFiles(modelId: string, includePaths?: boolean)
List resolved local file metadata for a single model
| Argument | Type | Required | Description |
|---|
| modelId | string | yes | Model ID (e.g. Qwen3-4B-GGUF) |
| includePaths? | boolean | no | Include absolute filesystem paths (privacy-sensitive) |
fn pull(modelName: string, source?: enum, checkpoints?: record)
Pull (download and install) a model — supports built-in models and custom Hugging Face checkpoints
| Argument | Type | Required | Description |
|---|
| modelName | string | yes | Model name to pull (e.g. Qwen3-0.6B-GGUF or user.MyModel) |
| source? | enum | no | Remote registry source (default: huggingface) |
| checkpoints? | record | no | Multi-file checkpoint map (e.g. { main: 'org/repo:file', mmproj: 'org/repo:mmproj' }) |
fn pullVariants(checkpoint: string)
Enumerate available GGUF quantizations for a Hugging Face checkpoint
| Argument | Type | Required | Description |
|---|
| checkpoint | string | yes | Hugging Face repo ID (e.g. unsloth/Qwen3-8B-GGUF) |
fn delete(modelName: string)
Delete a model from local storage
| Argument | Type | Required | Description |
|---|
| modelName | string | yes | Model name to delete |
fn checkUpdates()
Manually check downloaded models for upstream updates
fn load(modelName: string)
Load a model into memory (installs if necessary)
| Argument | Type | Required | Description |
|---|
| modelName | string | yes | Model name to load |
fn unload()
Unload a model from memory (or all models if none specified)
fn downloadsList()
List active, paused, cancelled, and errored download jobs
fn downloadsControl(id: string, action: enum)
Control a download job — pause, cancel, or remove
| Argument | Type | Required | Description |
|---|
| id | string | yes | Download job ID (e.g. model:Qwen3-0.6B-GGUF) |
| action | enum | yes | Action to perform |
fn chat(model: string, messages: array, temperature?: number, maxTokens?: number, maxCompletionTokens?: number, topP?: number, frequencyPenalty?: number, presencePenalty?: number, seed?: number, stop?: union, tools?: array, toolChoice?: unknown, user?: string, extra?: record)
Chat completions — non-streaming
| Argument | Type | Required | Description |
|---|
| model | string | yes | Model name (must be loaded) |
| messages | array | yes | Chat messages |
| temperature? | number | no | Sampling temperature |
| maxTokens? | number | no | Max tokens to generate |
| maxCompletionTokens? | number | no | Max completion tokens |
| topP? | number | no | Nucleus sampling parameter |
| frequencyPenalty? | number | no | Frequency penalty |
| presencePenalty? | number | no | Presence penalty |
| seed? | number | no | Deterministic sampling seed |
| stop? | union | no | Stop sequences |
| tools? | array | no | Available tools |
| toolChoice? | unknown | no | Tool choice behavior |
| user? | string | no | User identifier for rate limiting |
| extra? | record | no | Additional OpenAI params forwarded as-is |
fn chatStream(model: string, messages: array, temperature?: number, maxTokens?: number, maxCompletionTokens?: number, topP?: number, frequencyPenalty?: number, presencePenalty?: number, seed?: number, stop?: union, tools?: array, toolChoice?: unknown, user?: string, extra?: record)
Streaming chat completions — parses SSE and accumulates into a final response
| Argument | Type | Required | Description |
|---|
| model | string | yes | Model name (must be loaded) |
| messages | array | yes | Chat messages |
| temperature? | number | no | Sampling temperature |
| maxTokens? | number | no | Max tokens to generate |
| maxCompletionTokens? | number | no | Max completion tokens |
| topP? | number | no | Nucleus sampling parameter |
| frequencyPenalty? | number | no | Frequency penalty |
| presencePenalty? | number | no | Presence penalty |
| seed? | number | no | Deterministic sampling seed |
| stop? | union | no | Stop sequences |
| tools? | array | no | Available tools |
| toolChoice? | unknown | no | Tool choice behavior |
| user? | string | no | User identifier for rate limiting |
| extra? | record | no | Additional OpenAI params forwarded as-is |
fn completions(model: string, prompt: string, temperature?: number, maxTokens?: number, topP?: number, frequencyPenalty?: number, presencePenalty?: number, stop?: union, seed?: number, extra?: record)
Text completions — legacy OpenAI textCompletion endpoint
| Argument | Type | Required | Description |
|---|
| model | string | yes | Model name (must be loaded) |
| prompt | string | yes | Text prompt to complete |
| temperature? | number | no | Sampling temperature |
| maxTokens? | number | no | Max tokens to generate |
| topP? | number | no | Nucleus sampling parameter |
| frequencyPenalty? | number | no | Frequency penalty |
| presencePenalty? | number | no | Presence penalty |
| stop? | union | no | Stop sequences |
| seed? | number | no | Deterministic sampling seed |
| extra? | record | no | Additional OpenAI params forwarded as-is |
fn embeddings(model: string, input: union, extra?: record)
Generate embeddings for input text
| Argument | Type | Required | Description |
|---|
| model | string | yes | Embedding model name (must be loaded) |
| input | union | yes | Input text(s) to embed |
| extra? | record | no | Additional OpenAI params forwarded as-is |
fn responses(model: string, input: union, instructions?: string, extra?: record)
OpenAI Responses API for structured outputs
| Argument | Type | Required | Description |
|---|
| model | string | yes | Model name |
| input | union | yes | Input messages or items |
| instructions? | string | no | System instructions |
| extra? | record | no | Additional params forwarded as-is |
fn audioTranscribe(model: string, file: string, language?: string, prompt?: string, timestampGranularities?: array)
Transcribe audio file to text
| Argument | Type | Required | Description |
|---|
| model | string | yes | Whisper model name |
| file | string | yes | Audio file path (local path uses multipart upload; base64 string sent as JSON) |
| language? | string | no | Language code (e.g. en, ja) |
| prompt? | string | no | Optional transcription prompt |
| timestampGranularities? | array | no | Output granularities |
fn audioSpeech(model: string, input: string, voice?: string, responseFormat?: enum, speed?: number)
Generate speech from text
| Argument | Type | Required | Description |
|---|
| model | string | yes | TTS model name |
| input | string | yes | Text to synthesize |
| voice? | string | no | Voice to use |
| responseFormat? | enum | no | Output format (mp3, wav, opus, pcm) |
| speed? | number | no | Speech speed (0.25–4.0) |
fn audioGenerate(model: string, prompt: string, duration?: number, steps?: number, cfg?: number, seed?: number)
Generate music or sound effects from text prompt
| Argument | Type | Required | Description |
|---|
| model | string | yes | Music generation model name |
| prompt | string | yes | Text prompt for music/SFX |
| duration? | number | no | Duration in seconds |
| steps? | number | no | Number of inference steps |
| cfg? | number | no | Classifier-free guidance strength (ThinkSound only) |
| seed? | number | no | Random seed for reproducibility |
fn imagesGenerate(model: string, prompt: string, negativePrompt?: string, numImages?: number, size?: string, steps?: number, cfgScale?: number, seed?: number, extra?: record)
Generate images from text prompts
| Argument | Type | Required | Description |
|---|
| model | string | yes | Image generation model name (e.g. SD-Turbo, SD-1.5) |
| prompt | string | yes | Image prompt |
| negativePrompt? | string | no | Negative prompt |
| numImages? | number | no | Number of images to generate (n=1 supported) |
| size? | string | no | Image size as WIDTHxHEIGHT (e.g. 512x512, 256x256) |
| steps? | number | no | Generation steps |
| cfgScale? | number | no | Classifier-free guidance scale |
| seed? | number | no | Random seed for reproducibility |
| extra? | record | no | Additional params forwarded as-is |
fn imagesEdit(model: string, image: string, mask?: string, prompt: string, numImages?: number, size?: string, steps?: number, cfgScale?: number, seed?: number, extra?: record)
Edit an existing image with a mask and prompt
| Argument | Type | Required | Description |
|---|
| model | string | yes | Image generation model name |
| image | string | yes | Local file path (uses multipart upload) or base64-encoded image |
| mask? | string | no | Mask image for inpainting |
| prompt | string | yes | Edit prompt |
| numImages? | number | no | Number of images (1-10) |
| size? | string | no | Output size as WIDTHxHEIGHT (e.g. 512x512) |
| steps? | number | no | Generation steps |
| cfgScale? | number | no | Classifier-free guidance scale |
| seed? | number | no | Random seed for reproducibility |
| extra? | record | no | Additional params forwarded as-is |
fn imagesVariation(model: string, image: string, numImages?: number, size?: string, extra?: record)
Create a variation of an existing image
| Argument | Type | Required | Description |
|---|
| model | string | yes | Image generation model name |
| image | string | yes | Local file path (uses multipart upload) or base64-encoded image |
| numImages? | number | no | Number of variations (1-10) |
| size? | string | no | Output size as WIDTHxHEIGHT (e.g. 512x512) |
| extra? | record | no | Additional params forwarded as-is |
fn threeDGenerate(model: string, image: string, resolution?: union, bgRemoval?: enum, seed?: number, dryRun?: boolean)
Generate a textured 3D mesh (GLB) from an image
| Argument | Type | Required | Description |
|---|
| model | string | yes | 3D generation model name (e.g. TRELLIS-3D) |
| image | string | yes | Base64-encoded input image (optionally a data: URL) |
| resolution? | union | no | Cascade resolution: 512, 1024, or 1536 |
| bgRemoval? | enum | no | Background removal mode |
| seed? | number | no | Random seed for reproducibility |
| dryRun? | boolean | no | If true, validate inputs without generating |
fn backendInstall(recipe: string, backend: string, extra?: record)
Install or update a backend (llamacpp, whispercpp, cloud, etc.)
| Argument | Type | Required | Description |
|---|
| recipe | string | yes | Recipe name (e.g. llamacpp, whispercpp, sd-cpp, flm) |
| backend | string | yes | Backend name within the recipe (e.g. vulkan, rocm, cpu, cloud) |
| extra? | record | no | Additional params forwarded as-is (e.g. stream, force) |
fn backendUninstall(recipe: string, backend: string, extra?: record)
Remove a backend
| Argument | Type | Required | Description |
|---|
| recipe | string | yes | Recipe name (e.g. llamacpp, whispercpp) |
| backend | string | yes | Backend name to remove (e.g. vulkan, cpu) |
| extra? | record | no | Additional params forwarded as-is |
fn cloudAuth(provider: string, apiKey: string, extra?: record)
Set or update a cloud provider API key
| Argument | Type | Required | Description |
|---|
| provider | string | yes | Cloud provider (e.g. hf for HuggingFace) |
| apiKey | string | yes | API key |
| extra? | record | no | Additional params forwarded as-is |
fn cloudClearAuth(provider: string)
Clear a cloud provider API key
| Argument | Type | Required | Description |
|---|
| provider | string | yes | Cloud provider to clear (e.g. hf) |