Skip to content

VLM pipeline returns 400 Bad Request against local OpenAI-compatible server (LM Studio) – LM Studio logs “Channel Error” #2198

Description

@homerokzam

Bug

When running VlmPipeline with ApiVlmOptions pointing to a local OpenAI-compatible endpoint (LM Studio, /v1/chat/completions), the pipeline fails with requests.exceptions.HTTPError: 400 Client Error: Bad Request. On the LM Studio side, the server prints Error: Channel Error. I’m unsure whether Docling’s VLM request shape is incompatible with LM Studio’s OpenAI shim, or if I’m misconfiguring ApiVlmOptions.

Steps to reproduce

Minimal snippet (imports and flow trimmed for brevity; replace "some.pdf" with any PDF):

from docling.datamodel.base_models import InputFormat from docling.datamodel.pipeline_options import VlmPipelineOptions from docling.datamodel.pipeline_options_vlm_model import ApiVlmOptions, ResponseFormat from docling.document_converter import DocumentConverter, PdfFormatOption from docling.pipeline.vlm_pipeline import VlmPipeline

def lms_vlm_options(model: str, prompt: str, format: ResponseFormat):
return ApiVlmOptions(
url="http://localhost:1234/v1/chat/completions",
params=dict(model=model),
prompt=prompt,
timeout=90,
scale=1.0,
response_format=format,
)

pipeline_options = VlmPipelineOptions(
vlm_options=lms_vlm_options(
model="smoldocling-256m-preview-mlx-docling-snap",
prompt="Convert this page to docling.",
format=ResponseFormat.DOCTAGS,
),
enable_remote_services=True,
)

converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(
pipeline_cls=VlmPipeline,
pipeline_options=pipeline_options,
),
}
)

doc = converter.convert(source="some.pdf").document
md = doc.export_to_markdown()
print(md[:500])

Expected behavior
• The VLM request succeeds and Docling returns the converted document/markdown, or
• Docling surfaces a clear, actionable error indicating what part of the request is incompatible (e.g., payload shape for images, unsupported parameter, wrong endpoint).

Actual behavior
Client side:
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:1234/v1/chat/completions

LM Studio server log:
[LM STUDIO SERVER] Running chat completion on conversation with 1 messages.
[ERROR] Error: Channel Error

Docling version

docling 2.50.0

Python version

Python 3.12.7

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions