mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
update openrouter model to work with new openai client
This commit is contained in:
parent
fe9423d7b8
commit
b7d90197a9
1 changed files with 4 additions and 4 deletions
|
@ -21,13 +21,13 @@ class OpenRouterModel(Model):
|
|||
if cached_model_details is None:
|
||||
cached_model_details = client.models.list().data
|
||||
found = next(
|
||||
(details for details in cached_model_details if details.get("id") == name), None
|
||||
(details for details in cached_model_details if details.id == name), None
|
||||
)
|
||||
|
||||
if found:
|
||||
self.max_context_tokens = int(found.get("context_length"))
|
||||
self.prompt_price = round(float(found.get("pricing").get("prompt")) * 1000, 6)
|
||||
self.completion_price = round(float(found.get("pricing").get("completion")) * 1000, 6)
|
||||
self.max_context_tokens = int(found.context_length)
|
||||
self.prompt_price = round(float(found.pricing.get("prompt")) * 1000, 6)
|
||||
self.completion_price = round(float(found.pricing.get("completion")) * 1000, 6)
|
||||
|
||||
else:
|
||||
raise ValueError(f"invalid openrouter model: {name}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue