
    i
                         U d Z ddlZddlmZ ddlmZ ddlmZ  ej        e	          Z
daee         dz  ed<    G d de          Z ed	d
ddddddd	  	        Z ee           dS )zOpenRouter provider profile.    N)Any)register_provider)ProviderProfile_CACHEc                        e Zd ZdZddddedz  dedee         dz  f fdZdd	d
edz  dede	eef         fdZ
dddde	dz  dededee	eef         e	eef         f         fdZ xZS )OpenRouterProfileuM   OpenRouter aggregator — provider preferences, reasoning config passthrough.Ng       @api_keytimeoutr
   r   returnc                    t           t           S 	 t                                          d|          }||a |S # t          $ r&}t                              d|           Y d}~dS d}~ww xY w)u|  Fetch from public OpenRouter catalog — no auth required.

        Note: Tool-call capability filtering is applied by hermes_cli/models.py
        via fetch_openrouter_models() → _openrouter_model_supports_tools(), not
        here. The picker early-returns via the dedicated openrouter path before
        reaching this method, so filtering here would be unreachable.
        Nr	   zfetch_models(openrouter): %s)r   superfetch_models	Exceptionloggerdebug)selfr
   r   resultexc	__class__s        P/home/piyush/.hermes/hermes-agent/plugins/model-providers/openrouter/__init__.pyr   zOpenRouterProfile.fetch_models   s     M	WW))$)HHF!M 	 	 	LL7===44444	s   (: 
A*A%%A*)
session_idr   contextc                B    i }|                     d          }|r||d<   |S )Nprovider_preferencesprovider)get)r   r   r   bodyprefss        r   build_extra_bodyz"OpenRouterProfile.build_extra_body*   s2      "233 	%$D    F)reasoning_configsupports_reasoningr"   r#   c                L    i }|r|t          |          |d<   nddd|d<   |i fS )zIOpenRouter passes the full reasoning_config dict as extra_body.reasoning.N	reasoningTmedium)enabledeffort)dict)r   r"   r#   r   
extra_bodys        r   build_api_kwargs_extrasz)OpenRouterProfile.build_api_kwargs_extras3   sJ     &(
 	P+*./?*@*@
;''6:h*O*O
;'2~r!   )__name__
__module____qualname____doc__strfloatlistr   r   r)   r    booltupler+   __classcell__)r   s   @r   r   r      s3       WW
 #	   t 	
 
cT	     4 +/   4Z;>	c3h    )-#(	   + !	
  
tCH~tCH~-	.       r!   r   
openrouter)or)OPENROUTER_API_KEY
OpenRouteru*   OpenRouter — unified API for 200+ modelszhttps://openrouter.ai/keyszhttps://openrouter.ai/api/v1z#https://openrouter.ai/api/v1/models)zanthropic/claude-sonnet-4.6zopenai/gpt-5.4zdeepseek/deepseek-chatzgoogle/gemini-3-flash-previewzqwen/qwen3-plus)	namealiasesenv_varsdisplay_namedescription
signup_urlbase_url
models_urlfallback_models)r/   loggingtypingr   	providersr   providers.baser   	getLoggerr,   r   r   r2   r0   __annotations__r   r6    r!   r   <module>rJ      s    " " "        ' ' ' ' ' ' * * * * * *		8	$	$S	D   3 3 3 3 3 3 3 3l 	$<++4  
$  *     r!   