Files
claude-code-system-prompts/system-prompts/data-sdk-api-error-params-field.md
T
2026-11-18 16:43:32 -07:00

3.6 KiB

@internal Parameters of api_error, present only for the kinds that have any. effort: the effort level the API refused (effort_requires_thinking). media (media_removed): the kind of block the API refused; absent for media_budget. media_reason (media_removed): unsupported_by_model — the API said that the model does not accept PDF documents; media_budget — the request's images and documents together exceed the API's limit, and the requests that follow may leave out blocks of either kind; unprocessable — every other refusal, a gateway's report of a model's refusal among them. provider: the API provider whose credentials failed (provider_credentials, gateway_session_expired). remedy (provider_credentials, gateway_session_expired): refresh_command — a configured refresh command (awsAuthRefresh / gcpAuthRefresh) refreshes the credentials; refresh_credentials — refresh the provider's credentials by hand, no command is configured; adc — refresh the Google application default credentials or the GOOGLE_APPLICATION_CREDENTIALS key file; gateway_token — replace the gateway token supplied through ANTHROPIC_AUTH_TOKEN or ANTHROPIC_CUSTOM_HEADERS; host_managed — the host application owns these credentials; model_access — the credentials work but the model is not enabled for this account and region (Amazon Bedrock). rate_limit_info (usage_limit_reached): what the refused request's own response said about the limit, in the shape rate_limit_event carries. It is read from the same values as the message text, so its status, limit and reset are the text's: status is rejected and isUsingOverage false, rateLimitType names the limit, resetsAt is when it resets, and overageStatus, overageResetsAt, overageDisabledReason and limitScope say whose spend cap it is (the person's own cap arrives as org_level_disabled_until, as on rate_limit_event, and memberSpendLimit marks it); dailyCapPaused is true when usage is paused for the organization; no other member is sent. It is that refusal's record and is never updated, so compare resetsAt with the clock before calling the limit current. rate_limit_info (model_requires_usage_credits): that refusal's record, read from the same headers as the message text: status is rejected and isUsingOverage false; rateLimitType is the response's claim (seven_day_overage_included when an included allowance was used up) and is absent when it named none; resetsAt, overageStatus, overageResetsAt, limitScope and memberSpendLimit come when the response had them; errorCode is credits_required when the body said so; overageDisabledReason is the disabled-reason header's when that header came with a claim or overage status, else the body's (the message text can also fall back to a reason cached from an earlier response, which the record does not carry); canUserPurchaseCredits and hasChargeableSavedPaymentMethod come from the body; the person's own cap arrives as org_level_disabled_until, as on rate_limit_event; no other member is sent. cut (max_output_tokens): which stop reason of the API cut the reply short, which max_output_tokens alone does not say: output_limit — max_tokens, the request's output-token maximum; context_window — model_context_window_exceeded, the model's context window. Absent on the one other error that carries max_output_tokens, the API's tool_use_block_cut_off, which api_error_code names.