fix(labs): allow Claude 3 vision models for OCR

The vision allowlist matched only the 3.5/3.7/4 families, so a
self-hoster pinned to claude-3-opus / claude-3-sonnet / claude-3-haiku
was wrongly blocked from lab OCR though those models read images. Add
the bare claude-3-{opus,sonnet,haiku} prefixes.
This commit is contained in:
Marc-André Bombeck committed 2026-06-20 12:59:29 +02:00
1 parent 8c19dc51a5
commit d0f21a484a
2 files changed
+13 -3

No files matched your search

@@ -6,8 +6,11 @@ import {
} from "../vision-capability";
describe("supportsVisionForConfig", () => {
it("accepts Claude 3.5+/4 family models for anthropic", () => {
it("accepts the Claude 3 / 3.5 / 3.7 / 4 families for anthropic", () => {
for (const model of [
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
"claude-3-5-sonnet-latest",
"claude-3-7-sonnet",
"claude-sonnet-4-6",
+9 -2
View File
@@ -15,12 +15,19 @@
/**
* Anthropic vision models. The Messages API `image` + `document` blocks are
* accepted by the Claude 3.5+ / 3.7 / 4 families. An older `claude-2*` /
* `claude-instant*` pin is text-only.
* accepted by the whole Claude 3 family (3 / 3.5 / 3.7) and the Claude 4
* family. An older `claude-2*` / `claude-instant*` pin is text-only.
*
* The bare `claude-3-opus` / `claude-3-sonnet` / `claude-3-haiku` prefixes are
* listed explicitly: a self-hoster pinned to e.g. `claude-3-opus-20240229`
* reads images, but the `claude-3-5` prefix does not match it.
*/
function anthropicSupportsVision(model: string): boolean {
const m = model.toLowerCase();
return (
m.startsWith("claude-3-opus") ||
m.startsWith("claude-3-sonnet") ||
m.startsWith("claude-3-haiku") ||
m.startsWith("claude-3-5") ||
m.startsWith("claude-3.5") ||
m.startsWith("claude-3-7") ||