Update openai_api.py

不用对openrouter.ai单独处理
This commit is contained in:
zhaoweiguo 2024-10-31 14:05:05 +08:00 committed by GitHub
parent 21d9c5aeed
commit 0c0cfe017f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,9 +114,6 @@ class OpenAILLM(BaseLLM):
elif hasattr(chunk.choices[0], "usage"):
# The usage of some services is an attribute of chunk.choices[0], such as Moonshot
usage = CompletionUsage(**chunk.choices[0].usage)
elif "openrouter.ai" in self.config.base_url and chunk_has_usage:
# due to it get token cost from api
usage = chunk.usage
has_finished = True
log_llm_stream("\n")