Skip to content

Bug: LM Studio fails with "context-window" error when sending images #734

Closed

Description

@haiphucnguyen

Description

When connected to LM Studio, text-only chats work fine, but sending messages that include images fails with a "context-window" error and causes the connection to fail. The model itself supports images and has a large context window configured, and images are correctly recognized when chatting directly in LM Studio. Even when explicitly specifying the model in Askimo's model settings, the issue persists.

Root Cause: Askimo encodes images as base64 strings and counts them as text tokens, causing
massive token inflation. A 2 MB image becomes ~1.8M tokens instead of the ~576-1152 visual tokens
that LM Studio actually uses.

Example

  • 2 MB image
    • LM Studio (binary): ~576-1152 visual tokens ✅ Works
    • Askimo (base64): ~1.8M text tokens ❌ Exceeds context window

Expected Behavior

  • Images should be successfully recognized and processed through Askimo when connected to LM Studio
  • The context-window error should not occur for models with adequate context window size
  • Chat with images should work the same way it does in LM Studio's native interface

Actual Behavior

  • Sending a message with images triggers: "context-window" error
  • The connection fails after the error
  • The model selection dropdown (when explicitly choosing the model) does not resolve the issue

Steps to Reproduce

  1. Connect Askimo to a local LM Studio instance
  2. Load a model that supports image input (e.g., LLaVA, GPT-4 Vision equivalent)
  3. Verify the model has a large context window configured in LM Studio
  4. Send a chat message that includes an image
  5. Observe the "context-window" error and connection failure

Technical Details

  • Text-only messages to LM Studio work correctly
  • Images work in LM Studio's native chat interface
  • Issue occurs regardless of explicit model selection in Askimo settings
  • Context window size in LM Studio is configured appropriately for image input

Activity

  1. haiphucnguyen commented on Sep 28, 2026

    @haiphucnguyen
    CollaboratorAuthor

    Closed by #735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions