okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
8667a3dbf
main
1/** 2* Anthropic clients add `/v1/messages` to the base URL themselves, so the base URL they are given is the server root (no `/v1`). 3* A base URL copied from an OpenAI-style setup ends in `/v1`, and the client then posts `/v1/v1/messages`. That one path means the 4* same as the real one; nothing else is aliased (an OpenAI client never adds `/v1` on its own). 5*/ 6const ALIASES = new Map ([[ '/v1/v1/messages' , '/v1/messages' ], [ '/v1/v1/messages/count_tokens' , '/v1/messages/count_tokens' ]]); 7 8export function apiPath ( path ) { 9const clean = path . length > 1 ?path . replace ( / \/ + $ / , '' ) :path ; 10return ALIASES . get ( clean ) ?? path ; 11} 12