@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
133 lines (132 loc) • 6.46 kB
JSON
{
"$schema": "./provider-rules.schema.json",
"id": "anthropic",
"defaultModel": "claude-sonnet-5-5",
"defaultModelNote": "The model used when neither the call nor ANTHROPIC_MODEL names one: the latest Sonnet (claude-sonnet-5-5, listed by GET /v1/models on 2026-11-30). It replaced claude-sonnet-4-6. Sonnet 5 rejects temperature and top_p (model-families.json samplingParamsRejected) and takes only adaptive thinking (adaptiveThinkingOnly); both rules are applied before a request is sent.",
"outputTokenCeilings": {
"rules": [
{ "match": "opus[-_.]?4", "value": 32000 },
{ "match": "sonnet[-_.]?4|haiku[-_.]?4", "value": 64000 },
{
"match": "(?:opus|sonnet|fable|mythos)[-_.]?5(?![0-9])",
"value": 128000
},
{ "match": "3[-_.]?7[-_.]?sonnet", "value": 64000 },
{ "match": "3[-_.]?5[-_.]?(?:sonnet|haiku)", "value": 8192 },
{ "match": "claude-3-(?:opus|sonnet|haiku)|3[-_.]?opus", "value": 4096 },
{ "match": "opus", "value": 32000 },
{ "match": "sonnet|haiku", "value": 64000 }
],
"default": 8192
},
"outputTokenCeilingNotes": {
"rules": "The largest max_tokens each Claude model accepts; the native Anthropic and Vertex Claude paths default to it and clamp to it, because the API answers 400 above it (getClaudeMaxOutputTokens). The first matching rule wins, so the order matters: Opus 4.x is 32K and Sonnet/Haiku 4.x 64K; Opus 5, Opus 5.5, Sonnet 5, Fable and Mythos are 128K (platform.claude.com models overview), where (?![0-9]) keeps dated 4.x ids such as opus-4-5-20251101 out; 3.7 Sonnet is 64K, 3.5 Sonnet and Haiku 8192, Claude 3 Opus, Sonnet and Haiku 4096; a bare family alias gets that family's modern ceiling.",
"default": "An id no rule matches gets a safe modern floor."
},
"errors": {
"useDefaults": false,
"rules": [
{
"status": 401,
"pattern": "API_KEY_INVALID|Invalid API key",
"class": "authentication",
"message": "Invalid Anthropic API key. Please check your ANTHROPIC_API_KEY environment variable."
},
{
"status": 429,
"messageStatus": 429,
"pattern": "rate limit|too_many_requests",
"class": "rate-limit",
"message": "Anthropic rate limit exceeded. Please try again later."
},
{
"pattern": "ECONNRESET|ENOTFOUND|ECONNREFUSED|network|connection",
"class": "network",
"message": "Connection error: {message}"
},
{
"statusRange": [500, 599],
"pattern": "server error|bad gateway|service unavailable|gateway timeout|\\berror\\b\\D{0,12}\\b5\\d\\d\\b|\\b5\\d\\d\\b\\D{0,12}\\berror\\b|\\bstatus(?:\\s*code)?\\b\\D{0,12}\\b5\\d\\d\\b",
"class": "provider",
"message": "Server error: {message}"
},
{
"always": true,
"class": "provider",
"message": "Anthropic error: {message}"
}
]
},
"finishReasons": {
"messages": {
"map": {
"max_tokens": "length",
"tool_use": "tool-calls",
"refusal": "content-filter"
},
"default": "stop",
"defaultAtToolCap": "tool-calls"
}
},
"toolChoices": {
"messages": {
"modes": {
"auto": null,
"none": {
"type": "none"
},
"required": {
"type": "any"
}
},
"acceptStrings": true,
"acceptModeObjects": false,
"tool": {
"type": "tool",
"name": "{toolName}"
},
"toolRequiresName": true,
"fallback": null
}
},
"thinkingLimits": {
"minBudgetTokens": 1024,
"answerReserveTokens": 1024
},
"thinkingLimitNotes": {
"minBudgetTokens": "Anthropic rejects a budget_tokens below 1024 with a 400. When no budget of at least this size fits, thinking is omitted rather than coerced.",
"answerReserveTokens": "budget_tokens must stay below max_tokens (a 400 otherwise), so the budget is clamped to max_tokens minus this reserve, leaving room for the answer. Used by the direct Anthropic and Vertex Claude paths."
},
"requestDefaults": {
"largeOutputThresholdTokens": 8192,
"largeOutputTimeoutFloorMs": 300000,
"clientTimeoutMs": 600000
},
"requestDefaultNotes": {
"largeOutputThresholdTokens": "Above 8192 max_tokens a non-streaming call can run for minutes, so the generate timeout is raised (unless the caller forwarded one).",
"largeOutputTimeoutFloorMs": "Five minutes: the floor the raised timeout never goes below.",
"clientTimeoutMs": "An explicit SDK client timeout. With one set, the SDK skips its 'streaming is required for long requests' pre-flight, which would otherwise reject a large max_tokens on a non-streaming call."
},
"requestFields": {
"maxTokens": "max_tokens",
"temperature": "temperature",
"topP": "top_p",
"stopSequences": "stop_sequences",
"toolSchema": "input_schema"
},
"requestFieldNotes": {
"scope": "The Anthropic Messages wire, used by direct Anthropic and by Claude on Vertex. toWireParams() writes a request from neutral names; unset values and empty lists are left out.",
"omitWhileThinking": "Extended thinking fixes sampling: Anthropic rejects any temperature but 1 while thinking is on, and does not honour top_p there, so both are left out of a thinking request.",
"toolSchema": "The field of a tool declaration that holds the tool's JSON Schema. toolDeclaration() writes it and toolSchemaOf() reads it back."
},
"toolResults": {
"errorTemplate": "Error executing tool {name}: {error}",
"errorFlag": "is_error"
},
"contextTexts": {
"elisionNote": "[Earlier tool exchanges were removed to fit the context window.]"
},
"requestFieldRules": {
"omitWhileThinking": ["temperature", "topP"]
}
}