claude-proxy / patch_get_client.py
dheraingoud's picture
Deploy latest upstream with key rotation, vision adapter, and HF configs
61bb677
Raw
History Blame Contribute Delete
1.08 kB
# Patch openai_chat/provider.py
with open('src/free_claude_code/providers/openai_chat/provider.py', 'r', encoding='utf-8') as f:
code = f.read()
if 'def _get_client(self):' not in code:
code = code.replace(
' def _build_request_body(',
' def _get_client(self):\n return self._client\n\n def _build_request_body('
)
with open('src/free_claude_code/providers/openai_chat/provider.py', 'w', encoding='utf-8') as f:
f.write(code)
# Patch nvidia_nim/client.py
with open('src/free_claude_code/providers/nvidia_nim/client.py', 'r', encoding='utf-8') as f:
code = f.read()
if 'def _get_client(self):' not in code:
func = '''
def _get_client(self):
if hasattr(self, '_rotator') and self._rotator:
return self._rotator.get_client()
return self._client
'''
code = code.replace(
' def _build_request_body(',
f'{func}\n def _build_request_body('
)
with open('src/free_claude_code/providers/nvidia_nim/client.py', 'w', encoding='utf-8') as f:
f.write(code)