Skip to content

Moondream

Moondream 3.1 and Moondream 3 Preview are Moondream's small vision-language models for understanding images (9B parameters, 2B active per token). They are used for visual question answering, captions, reading text in images (OCR) and visual reasoning. On LLMTR they are called through /v1/chat/completions; they take text and image input and return text.

Model Context Input / Output ($/1M)
moondream/moondream3.1-9b-a2b 32,000 0.3 / 2.5
moondream/moondream3-preview 32,000 0.3 / 2.5

Moondream 3.1 is the newer release of the family; Moondream 3 Preview is the preview release of Moondream 3. Both take the same request shape. Prompts and text reading work best in English and Latin scripts.

Images are sent in an image_url part as a base64 data URL. https:// URLs are not accepted; LLMTR refuses such a request with 400 before it reaches the provider.

Terminal window
IMAGE_B64=$(base64 -w0 product.png)
curl "$LLMTR_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer llmtr-your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "moondream/moondream3.1-9b-a2b",
"messages": [
{
"role": "user",
"content": [
{ "type": "image_url", "image_url": { "url": "data:image/png;base64,'"$IMAGE_B64"'" } },
{ "type": "text", "text": "What colour is the t-shirt in this photo?" }
]
}
],
"max_tokens": 256
}'
import base64
from openai import OpenAI
client = OpenAI(base_url="https://llmtr.com/v1", api_key="llmtr-your_key")
with open("product.png", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="moondream/moondream3.1-9b-a2b",
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_b64}"}},
{"type": "text", "text": "What colour is the t-shirt in this photo?"},
],
}
],
max_tokens=256,
)
print(response.choices[0].message.content)
print(response.usage)

An image takes far more prompt tokens than text and is billed at the input price; how many it took shows in the response's usage.prompt_tokens. A request costs prompt_tokens times the input price plus completion_tokens times the output price; reasoning tokens are inside completion_tokens. Text-only requests without an image are accepted too.

Reasoning is off by default. For questions that need a closer look, add "reasoning": true to the request body or put the :think suffix on the model id (moondream/moondream3.1-9b-a2b:think). "reasoning": false and :fast keep it off.

{
"model": "moondream/moondream3.1-9b-a2b",
"reasoning": true,
"messages": [
{
"role": "user",
"content": [
{ "type": "image_url", "image_url": { "url": "data:image/png;base64,<BASE64>" } },
{ "type": "text", "text": "How many shoes are visible in the photo?" }
]
}
],
"max_tokens": 512
}

With reasoning on, the trace comes back separately from the answer: in message.reasoning_content on a non-streamed response, and in choices[].delta.reasoning_content chunks when streaming (stream: true). Those tokens are counted in completion_tokens and billed at the output price. The trace does not always match the answer; take the answer from message.content.

reasoning_effort is not supported; a request that sends it is refused with 400.

These models offer no tool calling, no JSON output mode and no stop sequences. LLMTR refuses the fields that would change the answer with 400 before they reach the provider. The empty forms that change nothing are removed from the request and listed in the response's llmtr_dropped_parameters field.

You send Result What to do
Non-empty tools 400 Remove tools and tool_choice.
response_format (json_object, json_schema) 400 Remove it, describe the format you need in the prompt and validate the reply on your side.
Non-empty stop 400 Remove it; cut the reply at your own delimiter or limit its length with max_tokens.
Empty tools, tool_choice without tools, response_format: { "type": "text" }, empty stop Removed Nothing to do.
seed, include_reasoning Removed Nothing to do; turn reasoning on with reasoning.

A refused request is not charged.

Field Behaviour
max_tokens, max_completion_tokens Limit the output; a reply that reaches the limit ends with finish_reason: "length". The provider states a maximum output of 4,096 tokens; check finish_reason on long replies.
temperature, top_p Accepted.
presence_penalty, frequency_penalty, user Accepted.

stream: true is supported. Send stream_options: { "include_usage": true } and usage arrives in the last chunk.

This model is served through a third-party provider.