o
    PL
jT                  	   @   sp   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	e
ZG dd deZeddd	d
ddddZee dS )z"Native Anthropic provider profile.    N)register_provider)ProviderProfilec                   @   s:   e Zd ZdZddddedB dedee dB fdd	ZdS )
AnthropicProfileu7   Native Anthropic — uses x-api-key header, not Bearer.Ng       @)api_keytimeoutr   r   returnc             
   C   s   |sdS zEt jd}|d| |dd |dd t jj||d}t|  }W d   n1 s9w   Y  d	d
 |	dg D W S  t
yb } ztd| W Y d}~dS d}~w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                 S   s&   g | ]}t |trd |v r|d  qS )id)
isinstancedict).0m r   N/home/kuhnn/.hermes/hermes-agent/plugins/model-providers/anthropic/__init__.py
<listcomp>    s    z1AnthropicProfile.fetch_models.<locals>.<listcomp>datazfetch_models(anthropic): %s)urllibrequestRequest
add_headerurlopenjsonloadsreaddecodeget	Exceptionloggerdebug)selfr   r   reqrespr   excr   r   r   fetch_models   s$   
zAnthropicProfile.fetch_models)__name__
__module____qualname____doc__strfloatlistr#   r   r   r   r   r      s    
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   r+   r   r   r   r   <module>   s$    

