[GH-ISSUE #15473] Ollama API failing while CLI works, without any difference #56403

Open
opened 2026-04-29 10:46:23 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @matteoberla on GitHub (Apr 10, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15473

Hi, I'm experiencing a strage behavior with API and CLI.

I'm trying to use deepseek-ocr to extract text from an image.
-CLI: ollama run deepseek-ocr "/Users/sasoftware/Downloads/image.png\nExtract text in markdown."
works fine and extract text without any problem.

-API: I'm calling localhost:11434/api/generate with this body:

{
    "model": "deepseek-ocr:latest",
    "prompt": "Read this receipt image and extract all the texts in MARKDOWN.",
    "stream": false,
    "images": [
        "iVBORw0....ElFTkSuQmCC"
    ]
}

but I'm receiving this response:

{
    "model": "deepseek-ocr:latest",
    "created_at": "2026-04-10T10:08:43.783512Z",
    "response": ")。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n",
    "done": false
}

How can it be possible? Do I have to specify other params inside the request body?
I've tried with many more images but only this one has this type of problem. Any suggestion would be really useful.

Image link on gDrive
and you can extract base64 from here

Mac mini M4 Pro 24GB

Originally created by @matteoberla on GitHub (Apr 10, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15473 Hi, I'm experiencing a strage behavior with API and CLI. I'm trying to use deepseek-ocr to extract text from an image. -CLI: `ollama run deepseek-ocr "/Users/sasoftware/Downloads/image.png\nExtract text in markdown."` works fine and extract text without any problem. -API: I'm calling `localhost:11434/api/generate` with this body: ``` { "model": "deepseek-ocr:latest", "prompt": "Read this receipt image and extract all the texts in MARKDOWN.", "stream": false, "images": [ "iVBORw0....ElFTkSuQmCC" ] } ``` but I'm receiving this response: ``` { "model": "deepseek-ocr:latest", "created_at": "2026-04-10T10:08:43.783512Z", "response": ")。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n)。\n\n", "done": false } ``` How can it be possible? Do I have to specify other params inside the request body? I've tried with many more images but only this one has this type of problem. Any suggestion would be really useful. [Image link on gDrive](https://drive.google.com/file/d/1L3lTgV60Ofc_lZY5DBNbxtqniPd2zayZ/view?usp=sharing) and you can extract base64 from [here](https://base64.guru/converter/encode/image) Mac mini M4 Pro 24GB
GiteaMirror added the bug label 2026-04-29 10:46:23 -05:00
Author
Owner

@gregoribic commented on GitHub (Apr 15, 2026):

Same here, with REST api mostly work, but on some images does not work properly. Tried with different parameters but it does not matter. Is api endpoint clipping posted data?

<!-- gh-comment-id:4250523102 --> @gregoribic commented on GitHub (Apr 15, 2026): Same here, with REST api mostly work, but on some images does not work properly. Tried with different parameters but it does not matter. Is api endpoint clipping posted data?
Author
Owner

@matteoberla commented on GitHub (Apr 15, 2026):

I had same problem without using an image too (@gregoribic I've started using Maternion/LightOnOCR-2:1b as model instead of deepseek-ocr).
Basically while using CLI / GUI everything works fine, but the same prompt with the API request remains hanging.

I think that something is handled differently between CLI/GUI and API request. hope that someone from Ollama can help with more explanation

<!-- gh-comment-id:4250709692 --> @matteoberla commented on GitHub (Apr 15, 2026): I had same problem without using an image too (@gregoribic I've started using `Maternion/LightOnOCR-2:1b` as model instead of `deepseek-ocr`). Basically while using CLI / GUI everything works fine, but the same prompt with the API request remains hanging. I think that something is handled differently between CLI/GUI and API request. hope that someone from Ollama can help with more explanation
Author
Owner

@gregoribic commented on GitHub (Apr 17, 2026):

I use glm-ocr model. It works most of the times but on some images it fails. I switch from openai rest format to ollama and it is a little more reliable.
Testing with cli on same images works fine everytime.
I checked context size, images size, .. you name it.
There is something different in processing input or calling a model from cli or from rest call.

<!-- gh-comment-id:4265589348 --> @gregoribic commented on GitHub (Apr 17, 2026): I use glm-ocr model. It works most of the times but on some images it fails. I switch from openai rest format to ollama and it is a little more reliable. Testing with cli on same images works fine everytime. I checked context size, images size, .. you name it. There is something different in processing input or calling a model from cli or from rest call.
Author
Owner

@PureBlissAK commented on GitHub (Apr 18, 2026):

🤖 Automated Triage & Analysis Report

Issue: #15473
Analyzed: 2026-04-18T18:20:55.711413

Analysis

  • Type: unknown
  • Severity: medium
  • Components: unknown

Implementation Plan

  • Effort: medium
  • Steps:

This issue has been triaged and marked for implementation.

<!-- gh-comment-id:4274307438 --> @PureBlissAK commented on GitHub (Apr 18, 2026): <!-- ollama-issue-orchestrator:v1 issue:15473 --> ## 🤖 Automated Triage & Analysis Report **Issue**: #15473 **Analyzed**: 2026-04-18T18:20:55.711413 ### Analysis - **Type**: unknown - **Severity**: medium - **Components**: unknown ### Implementation Plan - **Effort**: medium - **Steps**: *This issue has been triaged and marked for implementation.*
Author
Owner

@matteoberla commented on GitHub (Apr 18, 2026):

Thank you @PureBlissAK and @gregoribic

<!-- gh-comment-id:4274477947 --> @matteoberla commented on GitHub (Apr 18, 2026): Thank you @PureBlissAK and @gregoribic
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#56403