Skip to content

org-links sent as image to openai cause error 400 #1544

Description

@Inkbottle007

Please update gptel first -- errors are often fixed by the time they're reported.

  • I have updated gptel to the latest commit and tested that the issue still exists

Bug Description

configuration

Relevant config parts:

(gptel-make-openai "ChatGPT"
    :key    #'my-openai-api-key
    :stream nil
    :models '(gpt-5.5
              gpt-5.6-sol
              gpt-5.6-terra
              gpt-5.6-luna
              gpt-6-astra))
(gptel-make-preset 'gpt-6-astra-format-only
    :description       "OpenAI gpt-6-astra, formatting-only prompt"
    :backend           "ChatGPT"
    :model             'gpt-6-astra
    :system            my-gptel-prompt-format-only
    :request-params    '( :reasoning (:effort "high")
                          :text (:verbosity "medium"
                                            :format (:type "text")))
    :tools             nil
    :stream            nil
    :use-context       'system
    :track-media       t
    :include-reasoning t)

In my org-mode file I have:

#+begin_quote
Upper case (capital) letters, CDEFGAB, are used to denote the bottom octave (C represents middle C, on the first leger line below the treble stave), continuing with lower case letters for the top octave, cdefgab (b is the one above the first leger line above the stave).
--- [[https://abcnotation.com/blog/2010/01/31/how-to-understand-abc-the-basics/][How to understand abc … the basics « abc notation blog]]
#+end_quote

I've added: M-: (setq gptel-log-level 'info)

I run

When doing M-x gptel-send with the preset above.

error 400

I get

((HTTP/2 400) invalid_request_error) The image data you provided does not represent a valid image. please check...

When inspecting *gptel-log* I see:

        {
          "type": "input_image",
          "image_url": "https://abcnotation.com/blog/2010/01/31/how-to-understand-abc-the-basics/"
        },

I obviously have the same issue with [[file:hello.txt]].

maybe I've just misread the manual?

Two issues IMO:

  1. [[file:hello.txt]] should not be sent as an image
  2. [[https://abcnotation.com/blog/2010/01/31/how-to-understand-abc-the-basics/][How to understand abc … the basics « abc notation blog]] should not be sent at all, as a media file.

Maybe I haven't read the documentation correctly, but IMO there should be a finer grained selection on what is sent and what isn't. And maybe not try to send every links meant for documentation purpose as if they should be scrutinized.

Regarding [[file:hello.txt]]
Maybe gptel intention is that every text based file I want to send to the model, I should do it using the context add feature?

The same context was working alright with claude model series.

Backend

No response

Steps to Reproduce

  1. use plain org-mode link or [[file:hello.txt]] with openai model
  2. gptel-send
  3. error 400

Additional Context

gnu emacs 30.2
nixos

Backtrace

Log Information

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions