400 unsupported_content_type: an image sent to a text-only model, a PDF, or audio
A 400 unsupported_content_type means the request carries something the chosen model doesn't accept. That's either an image in the last message sent to a model without vision, or a PDF, file, audio, or video block, which go2llm doesn't accept for any model. go2llm checks the body before it ever reaches a model, names the offending field in error.message, and for an image it also names a vision model you can switch to.
Images go to models whose modalities.input in GET /v1/models includes image and whose endpoints include chat.completions. go2llm turns vision on only where it has checked that the image actually reaches the model: a model that never got the image often won't say so, and confidently describes something it never saw. That's why Anthropic's own claude-opus-5 reads images, while in the go2llm catalog it's text-only as of November 19, 2026.
Written 2026-09-11, updated 2026-11-19: since November 18, models with vision accept images.
What it looks like
A model without vision answers an image in the last message with a 400. On POST /v1/messages the body comes back in Anthropic's shape:
{
"type": "error",
"error": {
"type": "invalid_request_error",
"code": "unsupported_content_type",
"message": "Only text input is supported; rejected image at request.messages[0].content[1].type. For image input use a vision model: claude-sonnet-5",
"request_id": "gw_…"
},
"request_id": "gw_…"
}
Reproduced with an image sent to a text-only model:
curl -i https://api.go2llm.tech/v1/messages \
-H "x-api-key: $GO2LLM_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5",
"max_tokens": 256,
"messages": [{"role":"user","content":[
{"type":"text","text":"What is in this image?"},
{"type":"image","source":{"type":"base64","media_type":"image/png","data":"iVBORw0KGgo="}}
]}]
}'
Fallback address: https://go2llm.tech/v1 (https://go2llm.tech for Anthropic clients) — same key, same models. Switch to it if api.go2llm.tech does not open or a non-streaming response takes longer than 100 seconds.
An image_url part on POST /v1/chat/completions or an input_image part on POST /v1/responses gets the same refusal when the model is text-only. On Chat Completions the body is in OpenAI's shape, with both error.type and error.code set to unsupported_content_type. A {"type":"document"} block carrying a PDF is rejected for every model, and then the message has no vision-model hint. For a vision model the message starts with Only text and image input is supported.
Two neighboring 400s share the status but not the code: invalid_request (the body isn't valid JSON, or isn't a JSON object — messages read request body must be valid JSON and request body must be a JSON object) and model_protocol_mismatch (the model was called through the wrong endpoint).
Why this happens
An image is in the last message, and the model has no vision. A text-only model is one whose modalities.input lists only text. If the image sits in the last message, or in the tool results of the last turn, go2llm returns a 400 and appends a vision model to error.message. It takes that model from the text model's vision_companion field in GET /v1/models; when there's no such field, it names the cheapest vision models on that endpoint. The check walks the body recursively and stops at the first block it finds, so the message always names exactly one path, even if the request has three images in it.
An image in earlier turns is not an error. A model without vision won't get images from earlier messages, but the request goes through. go2llm swaps each one for the line [image omitted: model glm-5.3 does not accept image input] and sets the x-go2llm-media-omitted response header to the number of swaps. PDFs and audio in the history get the same treatment. A long conversation full of screenshots keeps working after you move it to a text model; the 400 only comes when such a block is in the last message.
A PDF, file, audio, or video block. A {"type":"document"} block carrying a PDF, input_file and file_id in the Responses API, input_audio, and video are rejected for every model, vision models included. A vision model answers with Only text and image input is supported; rejected document at request.messages[0].content[0].type; for a text model the message starts with Only text input is supported. On POST /v1/responses a file gets its own message: file inputs are not supported; send images as data URLs or https URLs.
A library attached the block for you. LangChain, LlamaIndex, and similar frameworks can auto-attach a screenshot, a PDF page, or an image pulled from a RAG index. Nobody on your team wrote that attachment into the request, but it's there. The path in error.message shows exactly which message and block index carries it.
An image-generation model was called on the wrong endpoint. Image-generation models run on POST /v1/images/generations, and some of them on POST /v1/images/edits as well; their endpoints in GET /v1/models list images.generations. Calling one through POST /v1/chat/completions gives 400 model_protocol_mismatch instead — check the catalog for the right endpoint.
The image endpoint got something other than JSON. POST /v1/images/generations only accepts content-type: application/json. multipart/form-data gets a 415, not a 400, with code unsupported_content_type and message image generation requires application/json.
The body is over 20 MiB. Anything larger comes back as a 413 with code request_too_large and message request body exceeds 20 MiB. Base64 inflates a file by roughly a third, so a 16 MB PDF can cross the limit once it's encoded.
Fixing the request
Read the path in error.message first — request.messages[0].content[1] means the first message, second content block.
If it's an image, switch to a vision model. Its ID is at the end of error.message, and the catalog gives you the full list without a key:
import requests
models = requests.get("https://api.go2llm.tech/v1/models", timeout=30).json()["data"]
vision = [m["id"] for m in models
if "image" in m["modalities"]["input"] and "chat.completions" in m["endpoints"]]
print(vision)
If it's a PDF, pull the text out of the file before you send anything. That's a local step:
import pypdf
def pdf_to_text(path: str, max_chars: int = 120_000) -> str:
reader = pypdf.PdfReader(path)
text = "\n\n".join((page.extract_text() or "") for page in reader.pages)
return text[:max_chars]
A scan has no text layer: render its pages to PNG and send them as images to a vision model.
Send the extracted text instead of the file, and the request goes through:
import os
from anthropic import Anthropic
client = Anthropic(base_url="https://api.go2llm.tech", api_key=os.environ["GO2LLM_API_KEY"])
msg = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[{"role": "user", "content": f"Summarize this document:\n\n{pdf_to_text('doc.pdf')}"}],
)
print(msg.usage) # cost_usd is on the response, same place as any other call
Add a check on your own side so a bad request never leaves your machine. Take accepts_image from the catalog: "image" in model["modalities"]["input"]. The function walks the whole last message, images inside tool_result included. If an agent answers with several tool results in a row (role: "tool"), run it over each of them.
IMAGE_TYPES = {"image", "image_url", "input_image"}
NEVER_TYPES = {"document", "file", "input_file", "audio", "input_audio", "video"}
def media_blocks(node, path):
if isinstance(node, dict):
kind = node.get("type")
if isinstance(kind, str) and kind in IMAGE_TYPES | NEVER_TYPES:
yield path, kind
for key, value in node.items():
yield from media_blocks(value, f"{path}.{key}")
elif isinstance(node, list):
for i, item in enumerate(node):
yield from media_blocks(item, f"{path}[{i}]")
def check_last_message(messages, accepts_image: bool):
bad = [f"{path} = {kind}" for path, kind in media_blocks(messages[-1], "messages[-1]")
if kind in NEVER_TYPES or not accepts_image]
if bad:
raise ValueError("go2llm will return 400: " + ", ".join(bad))
If image generation is what you actually need, use its own endpoint with a required Idempotency-Key header (8–128 printable ASCII characters):
curl https://api.go2llm.tech/v1/images/generations \
-H "Authorization: Bearer $GO2LLM_API_KEY" \
-H "Idempotency-Key: project-20260911-image-001" \
-H "content-type: application/json" \
-d '{"model":"gpt-image-2","prompt":"Minimalist diagram of an API gateway","n":1,"size":"1024x1024","quality":"standard","response_format":"url"}'
Keeping this from happening again
Pick the model for the input. If your users send screenshots, use a model with image in modalities.input, and check that against the catalog when your app starts rather than from memory: the catalog changes. Parse PDFs and other files in your own code, and give the model text or page images.
Run the body through check_last_message before you send it — the check costs microseconds and saves a request out of the 60 RPM per-key limit, which matters most for frameworks that assemble your messages for you.
Don't retry a 400. go2llm returns the same answer until the body or the model changes; unlike a 429 or a 502, backoff here just burns your rate limit for nothing.
If image generation is a real part of your flow, keep the Idempotency-Key in mind: reusing one key with a different body gives a 409 idempotency_conflict, and a media call that comes back ambiguous_upstream_result should never be auto-retried — the provider may already have accepted it, and a retry risks charging you twice.
Related errors
- 404 model_not_found — the model was called through the wrong endpoint, or the ID itself is wrong.
- 402 insufficient_balance — a large request runs into the balance instead.
- 429 rate_limit — the 60 RPM ceiling, exceeded.
- The full error reference.
FAQ
Which go2llm models accept images? The ones whose modalities.input in GET /v1/models includes image and whose endpoints include chat.completions. Image-generation models list image as input too, but they don't take chat requests. The list changes, so check the catalog: GET https://api.go2llm.tech/v1/models or the models page. All three APIs take images: image_url in Chat Completions, an image block in Messages, and input_image in Responses. Send the image as base64 or as an https URL.
Why did a vision model still return 400? The last message carries a PDF, file, audio, or video block rather than an image. go2llm doesn't accept those for any model, so the message starts with Only text and image input is supported and doesn't point you at another model. One more cause: the image came in an images field, Ollama-style. go2llm takes images only as content parts of type image_url, image, or input_image, and the message says so.
How much does an image cost? Before the call, go2llm reserves 1,600 input tokens per image at the model's price, then charges the actual cost from the response's usage. If the reserve doesn't fit your balance, you get a 402 insufficient_balance.
Why does the message only name one path when there are several images? The check stops at the first block the model doesn't accept and returns that path. Fix it, resend, and the next request will point at the next one — running check_last_message above over the last message lists them all at once and saves you the round trips.
How is 400 unsupported_content_type different from a 415? The 400 is for a block inside the request body that the model doesn't accept. The 415 with the same code comes from POST /v1/images/generations when its content-type header isn't application/json.
What's the largest request body go2llm accepts? 20 MiB. Anything larger gets a 413 with code request_too_large and message request body exceeds 20 MiB.
Get a key and make your first request in 3 minutes → go2llm.tech. The full list of endpoints and models is in the docs, and per-model details are on the pricing page.