Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenRouter error

OpenRouter 403 permission_denied: what it means and how to fix it

Error message
403 permission_denied

Retry? Not statedLast verified 1 documented fix1 source

What it means

The key is valid but lacks the required permission, or the request was blocked by a guardrail (for example a content filter or prompt-injection detector) before reaching a provider. On /messages the block is returned as an Anthropic permission_error envelope.

Causes

  • Insufficient permissions
  • Guardrail block, for example "Request blocked: prompt injection patterns detected"

How to fix it

  1. Fix 1.

    Read the block reason in error.message and error.metadata; opt in to router metadata with the X-OpenRouter-Experimental-Metadata: enabled header to see which guardrail stage ran.

More OpenRouter errors

All 32 OpenRouter errors

HTTP 403 at other providers

Compare 403 across providers

FAQ

What does the OpenRouter error "403 permission_denied" mean?

The key is valid but lacks the required permission, or the request was blocked by a guardrail (for example a content filter or prompt-injection detector) before reaching a provider. On /messages the block is returned as an Anthropic permission_error envelope.

How do I fix OpenRouter "403 permission_denied"?

Read the block reason in error.message and error.metadata; opt in to router metadata with the X-OpenRouter-Experimental-Metadata: enabled header to see which guardrail stage ran.

Should I retry OpenRouter "403 permission_denied"?

Not stated. The official docs do not say whether this error is retryable.

Which other AI APIs return HTTP 403?

Per their official error docs: Amazon Bedrock (403 AccessDeniedException; 403 InvalidClientTokenId; 403 MPAgreementBeingCreated; 403 AWS Marketplace Agreement Failed within 15 minutes; 403 AWS Marketplace Agreement Pending after 15 minutes), Anthropic API (403 permission_error), Azure OpenAI (403 Forbidden (network access denied); 403 Forbidden (resource has been temporarily blocked)), Gemini API (403 permission_denied; 403 PERMISSION_DENIED), Groq API (403 Forbidden), Mistral API (403 Forbidden), OpenAI API (403 Country, region, or territory not supported; 403 PermissionDeniedError), Vertex AI (403 PERMISSION_DENIED), xAI API (403 Forbidden).

Sources

Last verified against 1 source: OpenRouter's official docs and official SDK repositories.

Newsletter

Know when the APIs change

One email per week. New model releases, API changes, what broke, and how developers are working around it.