
    iT              	           d Z ddlZddlZddlZddlmZ ddlmZ  ej	        e
          Z G d de          Z eddd	d
ddd          Z ee           dS )z"Native Anthropic provider profile.    N)register_provider)ProviderProfilec                   F    e Zd ZdZddddedz  dedee         dz  fdZdS )	AnthropicProfileu7   Native Anthropic — uses x-api-key header, not Bearer.Ng       @)api_keytimeoutr   r   returnc                V   |sdS 	 t           j                            d          }|                    d|           |                    dd           |                    dd           t           j                            ||          5 }t          j        |                                                                          }ddd           n# 1 swxY w Y   d	 |	                    d
g           D             S # t          $ r&}t                              d|           Y d}~dS d}~ww xY w)z6Anthropic uses x-api-key header and anthropic-version.Nz#https://api.anthropic.com/v1/modelsz	x-api-keyzanthropic-versionz
2023-06-01Acceptzapplication/json)r   c                 P    g | ]#}t          |t                    rd |v |d          $S )id)
isinstancedict).0ms     O/home/piyush/.hermes/hermes-agent/plugins/model-providers/anthropic/__init__.py
<listcomp>z1AnthropicProfile.fetch_models.<locals>.<listcomp>    sA       a&& ,0199 $+499    datazfetch_models(anthropic): %s)urllibrequestRequest
add_headerurlopenjsonloadsreaddecodeget	Exceptionloggerdebug)selfr   r   reqrespr   excs          r   fetch_modelszAnthropicProfile.fetch_models   sl     	4	.(()NOOCNN;000NN.===NN8%7888''W'== 8z$))++"4"4"6"6778 8 8 8 8 8 8 8 8 8 8 8 8 8 8 &"--   
  	 	 	LL6<<<44444	s<   BC8 9CC8 CC8 C"C8 8
D(D##D()__name__
__module____qualname____doc__strfloatlistr'    r   r   r   r      sk        AA
 #	   t 	
 
cT	     r   r   	anthropic)claudezclaude-oauthzclaude-codeanthropic_messages)ANTHROPIC_API_KEYANTHROPIC_TOKENCLAUDE_CODE_OAUTH_TOKENzhttps://api.anthropic.comr   zclaude-haiku-4-5-20251001)namealiasesapi_modeenv_varsbase_url	auth_typedefault_aux_model)r+   r   loggingurllib.requestr   	providersr   providers.baser   	getLoggerr(   r!   r   r0   r/   r   r   <module>rB      s    ( (       ' ' ' ' ' ' * * * * * *		8	$	$       : 	5!P(1  	  )     r   