oc_chat
Loading...
Searching...
No Matches
providers.openai_compat.oauth Namespace Reference

Classes

class  OpenRouterOAuth

Functions

str _pasted_code (str value)
str _exchange (str code, str verifier)

Variables

Final TOKEN_ENDPOINTS
Final CALLBACK_URL = 'http://localhost:3000/'
Final AUTHORIZE_URL = 'https://openrouter.ai/auth'

Detailed Description

OpenRouter paste-only PKCE authentication.

Purpose
-------
Exchange a manually pasted authorization code for a provider key.

Responsibilities
----------------
Generate PKCE, display the URL through callbacks, and enforce transport policy.

Diagnostics
-----------
Domain: OC_CHAT.CLIENT
Levels:
    L2 - lifecycle
    L3 - semantic details without credentials
    L4 - module lifecycle

Contracts
---------
No listener, browser launch, refresh, proxy inheritance or redirect following.
The operator approved this fixed-endpoint sink outside ClientInterface for P6.
Credentials and transport exception contents never reach output channels.

Dependencies
------------
- oc_diagnostics (diagnostics)
- httpx (existing provider transport dependency)
- option_c_agent_contracts.provider_plugin (OAuth protocols and credentials)

Function Documentation

◆ _exchange()

str providers.openai_compat.oauth._exchange ( str code,
str verifier )
protected
Use the fixed HTTPS endpoint with no proxy inheritance or redirects.

Definition at line 75 of file oauth.py.

Here is the caller graph for this function:

◆ _pasted_code()

str providers.openai_compat.oauth._pasted_code ( str value)
protected
Accept a bare code or the exact callback URL copied from the browser.

Definition at line 58 of file oauth.py.

Here is the caller graph for this function:

Variable Documentation

◆ AUTHORIZE_URL

Final providers.openai_compat.oauth.AUTHORIZE_URL = 'https://openrouter.ai/auth'

Definition at line 55 of file oauth.py.

◆ CALLBACK_URL

Final providers.openai_compat.oauth.CALLBACK_URL = 'http://localhost:3000/'

Definition at line 54 of file oauth.py.

◆ TOKEN_ENDPOINTS

Final providers.openai_compat.oauth.TOKEN_ENDPOINTS
Initial value:
1= MappingProxyType({
2 'openrouter': 'https://openrouter.ai/api/v1/auth/keys',
3})

Definition at line 51 of file oauth.py.