9router/src/app/api/providers/[id]/test
Rehan Choirul 584cf66a70 fix(test): use POST /v1/messages to validate anthropic-compatible connections
GET /models is not part of the Anthropic API spec and many compatible
proxies do not implement it, causing the connection test to always fail
even with a valid API key.

Switch to POST /v1/messages with max_tokens=1 — the same approach used
for the built-in anthropic provider — and treat any non-401/403 response
as valid, since 400/529 still confirms the key was accepted.

Use node.defaultModel / connection.defaultModel when set so the test
respects the configured model rather than always falling back to
claude-3-haiku-20240307.

Co-authored-by: Rehan Choirul <rehanchrl@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-20 15:53:03 +07:00
..
route.js refactor: rename provider to alicode (Aliyun Coding) 2026-02-26 08:05:05 +08:00
testUtils.js fix(test): use POST /v1/messages to validate anthropic-compatible connections 2026-06-20 15:53:03 +07:00