
    nSj              	           d Z ddlZddlZddlZddlm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)open_credentialed_url)register_provider)ProviderProfilec            
       R    e Zd ZdZdddddedz  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base_urltimeoutr   r	   r
   returnc                6   |sdS 	 t           j                            d          }|                    d|           |                    dd           |                    dd           t	          ||          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     L/home/ice/.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_headerr   jsonloadsreaddecodeget	Exceptionloggerdebug)selfr   r	   r
   reqrespr   excs           r   fetch_modelszAnthropicProfile.fetch_models   sd     	4	.(()NOOCNN;000NN.===NN8%7888&sG<<< 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<   A2C( 89B=1C( =CC( C"C( (
D2DD)__name__
__module____qualname____doc__strfloatlistr(    r   r   r   r      s|        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_varsr	   	auth_typedefault_aux_model)r,   r   loggingurllib.requestr   hermes_cli.urllib_securityr   	providersr   providers.baser   	getLoggerr)   r"   r   r1   r0   r   r   <module>rC      s    ( (       < < < < < < ' ' ' ' ' ' * * * * * *		8	$	$       < 	5!P(1  	  )     r   