MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / __init__

Method __init__

camel/models/openrouter_model.py:61–85  ·  view source on GitHub ↗
(
        self,
        model_type: Union[ModelType, str],
        model_config_dict: Optional[Dict[str, Any]] = None,
        api_key: Optional[str] = None,
        url: Optional[str] = None,
        token_counter: Optional[BaseTokenCounter] = None,
        timeout: Optional[float] = None,
    )

Source from the content-addressed store, hash-verified

59
60 @api_keys_required([("api_key", "OPENROUTER_API_KEY")])
61 def __init__(
62 self,
63 model_type: Union[ModelType, str],
64 model_config_dict: Optional[Dict[str, Any]] = None,
65 api_key: Optional[str] = None,
66 url: Optional[str] = None,
67 token_counter: Optional[BaseTokenCounter] = None,
68 timeout: Optional[float] = None,
69 ) -> None:
70 if model_config_dict is None:
71 model_config_dict = OpenRouterConfig().as_dict()
72 api_key = api_key or os.environ.get("OPENROUTER_API_KEY")
73 url = url or os.environ.get(
74 "OPENROUTER_API_BASE_URL", "https://openrouter.ai/api/v1"
75 )
76 timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))
77
78 super().__init__(
79 model_type=model_type,
80 model_config_dict=model_config_dict,
81 api_key=api_key,
82 url=url,
83 token_counter=token_counter,
84 timeout=timeout,
85 )
86
87 def _prepare_request(
88 self,

Callers

nothing calls this directly

Calls 2

OpenRouterConfigClass · 0.90
as_dictMethod · 0.45

Tested by

no test coverage detected