API ReferenceAuthenticationExchange authorization code for API keyPOSThttps://openrouter.ai/api/v1/auth/keysExchange an authorization code from the PKCE flow for a user-controlled API keyRequestThis endpoint expects an object.codestringRequiredThe authorization code received from the OAuth redirectcode_verifierstringOptionalThe code verifier if code_challenge was used in the authorization requestcode_challenge_methodenumOptionalThe method used to generate the code challengeAllowed values:S256plainResponseSuccessfully exchanged code for an API keykeystringThe API key to use for OpenRouter requestsuser_idstringOptionalUser ID associated with the API keyErrors400Post Auth Keys Request Bad Request Error403Post Auth Keys Request Forbidden Error405Post Auth Keys Request Method Not Allowed Error