Skip to content
Moondream logo

moondream3.1-9B-A2B

Image-to-TextMoondream

Moondream 3 is a fast, efficient 9B mixture-of-experts vision language model (2B active parameters) that delivers frontier-level visual reasoning for tasks like object detection, pointing, OCR, and structured output.

Model Info
VisionYes
Unit Pricing$0.30 per M input tokens, $1.00 per M output tokens

Usage

TypeScript
export interface Env {
AI: Ai;
}
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const res = await fetch("https://cataas.com/cat");
const blob = await res.arrayBuffer();
const input = {
image: [...new Uint8Array(blob)],
prompt: "Generate a caption for this image",
max_tokens: 512,
};
const response = await env.AI.run(
"@cf/moondream/moondream3.1-9B-A2B",
input
);
return new Response(JSON.stringify(response));
},
} satisfies ExportedHandler<Env>;

Parameters

task
stringdefault: queryenum: query, caption, point, detectWhich Moondream skill to run.
image
stringInput image as a public HTTPS URL or base64 data URI. Optional for `query`; required for `caption`, `point`, and `detect`.
question
stringdefault: What's in this image?Question for the `query` task.
caption_length
stringdefault: normalenum: short, normal, longCaption length for the `caption` task.
target
stringdefault: personObject phrase to locate for `point` and `detect` tasks (e.g. 'person wearing a red shirt').
reasoning
booleandefault: trueEnable reasoning trace for the `query` task.
temperature
numberdefault: 0.2minimum: 0maximum: 2Sampling temperature.
top_p
numberdefault: 0.9minimum: 0maximum: 1Top-p (nucleus) sampling.
max_tokens
integerdefault: 8192minimum: 1maximum: 28672Max tokens to generate for `query` and `caption`.
max_objects
integerdefault: 150minimum: 1maximum: 500Max objects to return for `point` and `detect`.
stream
booleandefault: trueReturn incremental tokens for `query` and `caption`. `point` and `detect` do not support streaming.

API Schemas (Raw)

Input
Output