CablyAI.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from __future__ import annotations
  2. from ..typing import AsyncResult, Messages
  3. from .needs_auth import OpenaiAPI
  4. class CablyAI(OpenaiAPI):
  5. url = "https://cablyai.com"
  6. login_url = None
  7. needs_auth = False
  8. api_base = "https://cablyai.com/v1"
  9. working = True
  10. default_model = "Cably-80B"
  11. models = [default_model]
  12. model_aliases = {"cably-80b": default_model}
  13. @classmethod
  14. def create_async_generator(
  15. cls,
  16. model: str,
  17. messages: Messages,
  18. **kwargs
  19. ) -> AsyncResult:
  20. headers = {
  21. 'Accept': '*/*',
  22. 'Accept-Language': 'en-US,en;q=0.9',
  23. 'Content-Type': 'application/json',
  24. 'Origin': 'https://cablyai.com',
  25. 'Referer': 'https://cablyai.com/chat',
  26. 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
  27. }
  28. return super().create_async_generator(
  29. model=model,
  30. messages=messages,
  31. headers=headers,
  32. **kwargs
  33. )