webscout 8.3.1__py3-none-any.whl → 8.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of webscout might be problematic. Click here for more details.

Files changed (114) hide show
  1. webscout/AIutel.py +180 -78
  2. webscout/Bing_search.py +417 -0
  3. webscout/Extra/gguf.py +706 -177
  4. webscout/Provider/AISEARCH/__init__.py +1 -0
  5. webscout/Provider/AISEARCH/genspark_search.py +7 -7
  6. webscout/Provider/AISEARCH/stellar_search.py +132 -0
  7. webscout/Provider/ExaChat.py +84 -58
  8. webscout/Provider/GeminiProxy.py +140 -0
  9. webscout/Provider/HeckAI.py +85 -80
  10. webscout/Provider/Jadve.py +56 -50
  11. webscout/Provider/MCPCore.py +78 -75
  12. webscout/Provider/MiniMax.py +207 -0
  13. webscout/Provider/Nemotron.py +41 -13
  14. webscout/Provider/Netwrck.py +34 -51
  15. webscout/Provider/OPENAI/BLACKBOXAI.py +0 -4
  16. webscout/Provider/OPENAI/GeminiProxy.py +328 -0
  17. webscout/Provider/OPENAI/MiniMax.py +298 -0
  18. webscout/Provider/OPENAI/README.md +32 -29
  19. webscout/Provider/OPENAI/README_AUTOPROXY.md +238 -0
  20. webscout/Provider/OPENAI/TogetherAI.py +4 -17
  21. webscout/Provider/OPENAI/__init__.py +17 -1
  22. webscout/Provider/OPENAI/autoproxy.py +1067 -39
  23. webscout/Provider/OPENAI/base.py +17 -76
  24. webscout/Provider/OPENAI/deepinfra.py +42 -108
  25. webscout/Provider/OPENAI/e2b.py +0 -1
  26. webscout/Provider/OPENAI/flowith.py +179 -166
  27. webscout/Provider/OPENAI/friendli.py +233 -0
  28. webscout/Provider/OPENAI/mcpcore.py +109 -70
  29. webscout/Provider/OPENAI/monochat.py +329 -0
  30. webscout/Provider/OPENAI/pydantic_imports.py +1 -172
  31. webscout/Provider/OPENAI/scirachat.py +59 -51
  32. webscout/Provider/OPENAI/toolbaz.py +3 -9
  33. webscout/Provider/OPENAI/typegpt.py +1 -1
  34. webscout/Provider/OPENAI/utils.py +19 -42
  35. webscout/Provider/OPENAI/x0gpt.py +14 -2
  36. webscout/Provider/OPENAI/xenai.py +514 -0
  37. webscout/Provider/OPENAI/yep.py +8 -2
  38. webscout/Provider/OpenGPT.py +54 -32
  39. webscout/Provider/PI.py +58 -84
  40. webscout/Provider/StandardInput.py +32 -13
  41. webscout/Provider/TTI/README.md +9 -9
  42. webscout/Provider/TTI/__init__.py +3 -1
  43. webscout/Provider/TTI/aiarta.py +92 -78
  44. webscout/Provider/TTI/bing.py +231 -0
  45. webscout/Provider/TTI/infip.py +212 -0
  46. webscout/Provider/TTI/monochat.py +220 -0
  47. webscout/Provider/TTS/speechma.py +45 -39
  48. webscout/Provider/TeachAnything.py +11 -3
  49. webscout/Provider/TextPollinationsAI.py +78 -70
  50. webscout/Provider/TogetherAI.py +350 -0
  51. webscout/Provider/Venice.py +37 -46
  52. webscout/Provider/VercelAI.py +27 -24
  53. webscout/Provider/WiseCat.py +35 -35
  54. webscout/Provider/WrDoChat.py +22 -26
  55. webscout/Provider/WritingMate.py +26 -22
  56. webscout/Provider/XenAI.py +324 -0
  57. webscout/Provider/__init__.py +10 -5
  58. webscout/Provider/deepseek_assistant.py +378 -0
  59. webscout/Provider/granite.py +48 -57
  60. webscout/Provider/koala.py +51 -39
  61. webscout/Provider/learnfastai.py +49 -64
  62. webscout/Provider/llmchat.py +79 -93
  63. webscout/Provider/llmchatco.py +63 -78
  64. webscout/Provider/multichat.py +51 -40
  65. webscout/Provider/oivscode.py +1 -1
  66. webscout/Provider/scira_chat.py +159 -96
  67. webscout/Provider/scnet.py +13 -13
  68. webscout/Provider/searchchat.py +13 -13
  69. webscout/Provider/sonus.py +12 -11
  70. webscout/Provider/toolbaz.py +25 -8
  71. webscout/Provider/turboseek.py +41 -42
  72. webscout/Provider/typefully.py +27 -12
  73. webscout/Provider/typegpt.py +41 -46
  74. webscout/Provider/uncovr.py +55 -90
  75. webscout/Provider/x0gpt.py +33 -17
  76. webscout/Provider/yep.py +79 -96
  77. webscout/auth/__init__.py +55 -0
  78. webscout/auth/api_key_manager.py +189 -0
  79. webscout/auth/auth_system.py +100 -0
  80. webscout/auth/config.py +76 -0
  81. webscout/auth/database.py +400 -0
  82. webscout/auth/exceptions.py +67 -0
  83. webscout/auth/middleware.py +248 -0
  84. webscout/auth/models.py +130 -0
  85. webscout/auth/providers.py +279 -0
  86. webscout/auth/rate_limiter.py +254 -0
  87. webscout/auth/request_models.py +127 -0
  88. webscout/auth/request_processing.py +226 -0
  89. webscout/auth/routes.py +550 -0
  90. webscout/auth/schemas.py +103 -0
  91. webscout/auth/server.py +367 -0
  92. webscout/client.py +121 -70
  93. webscout/litagent/Readme.md +68 -55
  94. webscout/litagent/agent.py +99 -9
  95. webscout/scout/core/scout.py +104 -26
  96. webscout/scout/element.py +139 -18
  97. webscout/swiftcli/core/cli.py +14 -3
  98. webscout/swiftcli/decorators/output.py +59 -9
  99. webscout/update_checker.py +31 -49
  100. webscout/version.py +1 -1
  101. webscout/webscout_search.py +4 -12
  102. webscout/webscout_search_async.py +3 -10
  103. webscout/yep_search.py +2 -11
  104. {webscout-8.3.1.dist-info → webscout-8.3.3.dist-info}/METADATA +141 -99
  105. {webscout-8.3.1.dist-info → webscout-8.3.3.dist-info}/RECORD +109 -83
  106. {webscout-8.3.1.dist-info → webscout-8.3.3.dist-info}/entry_points.txt +1 -1
  107. webscout/Provider/HF_space/__init__.py +0 -0
  108. webscout/Provider/HF_space/qwen_qwen2.py +0 -206
  109. webscout/Provider/OPENAI/api.py +0 -1320
  110. webscout/Provider/TTI/fastflux.py +0 -233
  111. webscout/Provider/Writecream.py +0 -246
  112. {webscout-8.3.1.dist-info → webscout-8.3.3.dist-info}/WHEEL +0 -0
  113. {webscout-8.3.1.dist-info → webscout-8.3.3.dist-info}/licenses/LICENSE.md +0 -0
  114. {webscout-8.3.1.dist-info → webscout-8.3.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,367 @@
1
+ """
2
+ Webscout OpenAI-Compatible API Server
3
+
4
+ A FastAPI-based server that provides OpenAI-compatible endpoints for various LLM providers.
5
+ Supports streaming and non-streaming chat completions with comprehensive error handling,
6
+ authentication, and provider management.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import sys
13
+ import time
14
+ from datetime import datetime, timezone
15
+ from typing import Optional
16
+
17
+ import uvicorn
18
+ from fastapi import FastAPI
19
+ from fastapi.middleware.cors import CORSMiddleware
20
+ from fastapi.responses import RedirectResponse
21
+ from fastapi.openapi.docs import get_swagger_ui_html
22
+ from starlette.responses import HTMLResponse
23
+
24
+ from webscout.Litlogger import Logger, LogLevel, LogFormat, ConsoleHandler
25
+ from .config import ServerConfig, AppConfig
26
+ from .routes import Api
27
+ from .providers import initialize_provider_map, initialize_tti_provider_map
28
+ from .auth_system import initialize_auth_system
29
+
30
+ # Configuration constants
31
+ DEFAULT_PORT = 8000
32
+ DEFAULT_HOST = "0.0.0.0"
33
+ API_VERSION = "v1"
34
+
35
+ # Setup Litlogger
36
+ logger = Logger(
37
+ name="webscout.api",
38
+ level=LogLevel.INFO,
39
+ handlers=[ConsoleHandler(stream=sys.stdout)],
40
+ fmt=LogFormat.DEFAULT
41
+ )
42
+
43
+ # Global configuration instance
44
+ config = ServerConfig()
45
+
46
+
47
+ def create_app():
48
+ """Create and configure the FastAPI application."""
49
+ import os
50
+ app_title = os.getenv("WEBSCOUT_API_TITLE", "Webscout API")
51
+ app_description = os.getenv("WEBSCOUT_API_DESCRIPTION", "OpenAI API compatible interface for various LLM providers")
52
+ app_version = os.getenv("WEBSCOUT_API_VERSION", "0.2.0")
53
+ app_docs_url = os.getenv("WEBSCOUT_API_DOCS_URL", "/docs")
54
+ app_redoc_url = os.getenv("WEBSCOUT_API_REDOC_URL", "/redoc")
55
+ app_openapi_url = os.getenv("WEBSCOUT_API_OPENAPI_URL", "/openapi.json")
56
+
57
+ app = FastAPI(
58
+ title=app_title,
59
+ description=app_description,
60
+ version=app_version,
61
+ docs_url=None, # Disable default docs
62
+ redoc_url=app_redoc_url,
63
+ openapi_url=app_openapi_url,
64
+ )
65
+
66
+ # Simple Custom Swagger UI with WebScout footer
67
+ @app.get(app_docs_url, include_in_schema=False)
68
+ async def custom_swagger_ui_html():
69
+ html = get_swagger_ui_html(
70
+ openapi_url=app.openapi_url,
71
+ title=app.title + " - API Documentation",
72
+ ).body.decode("utf-8")
73
+
74
+ # Simple, clean footer with WebScout branding
75
+ footer_html = """
76
+ <div style='
77
+ position: fixed;
78
+ bottom: 0;
79
+ left: 0;
80
+ right: 0;
81
+ background: rgba(255, 255, 255, 0.95);
82
+ backdrop-filter: blur(10px);
83
+ border-top: 1px solid #e5e7eb;
84
+ padding: 12px 20px;
85
+ text-align: center;
86
+ font-size: 14px;
87
+ color: #6b7280;
88
+ z-index: 1000;
89
+ box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
90
+ '>
91
+ Powered by <a href='https://github.com/OEvortex/Webscout' target='_blank' style='
92
+ color: #6366f1;
93
+ text-decoration: none;
94
+ font-weight: 600;
95
+ transition: color 0.2s ease;
96
+ ' onmouseover='this.style.color="#4f46e5"' onmouseout='this.style.color="#6366f1"'>
97
+ WebScout
98
+ </a>
99
+ </div>
100
+ <style>
101
+ body {
102
+ padding-bottom: 60px !important;
103
+ }
104
+ .swagger-ui .topbar {
105
+ background-color: #fafafa;
106
+ border-bottom: 1px solid #e5e7eb;
107
+ }
108
+ .swagger-ui .info .title {
109
+ color: #1f2937;
110
+ }
111
+ .swagger-ui .btn.authorize {
112
+ background-color: #6366f1;
113
+ border-color: #6366f1;
114
+ }
115
+ .swagger-ui .btn.authorize:hover {
116
+ background-color: #4f46e5;
117
+ border-color: #4f46e5;
118
+ }
119
+ </style>
120
+ """
121
+
122
+ html = html.replace("</body>", f"{footer_html}</body>")
123
+ return HTMLResponse(content=html)
124
+
125
+ # Add CORS middleware
126
+ app.add_middleware(
127
+ CORSMiddleware,
128
+ allow_origins=["*"],
129
+ allow_credentials=True,
130
+ allow_methods=["*"],
131
+ allow_headers=["*"],
132
+ )
133
+
134
+ # Initialize authentication system with configuration
135
+ initialize_auth_system(
136
+ app,
137
+ auth_required=AppConfig.auth_required,
138
+ rate_limit_enabled=AppConfig.rate_limit_enabled
139
+ )
140
+ # Add startup event handler
141
+ @app.on_event("startup")
142
+ async def startup():
143
+ if hasattr(app.state, 'startup_event'):
144
+ await app.state.startup_event()
145
+
146
+ # Initialize API routes
147
+ api = Api(app)
148
+ api.register_validation_exception_handler()
149
+ api.register_routes()
150
+
151
+ # Initialize providers
152
+ initialize_provider_map()
153
+ initialize_tti_provider_map()
154
+
155
+ # Root redirect
156
+ @app.get("/", include_in_schema=False)
157
+ async def root():
158
+ return RedirectResponse(url="/docs")
159
+
160
+ return app
161
+
162
+
163
+ def create_app_debug():
164
+ """Create app in debug mode."""
165
+ return create_app()
166
+
167
+
168
+ def start_server(
169
+ port: int = DEFAULT_PORT,
170
+ host: str = DEFAULT_HOST,
171
+ api_key: str = None,
172
+ default_provider: str = None,
173
+ base_url: str = None,
174
+ workers: int = 1,
175
+ log_level: str = 'info',
176
+ debug: bool = False,
177
+ no_auth: bool = False,
178
+ no_rate_limit: bool = False
179
+ ):
180
+ """Start the API server with the given configuration."""
181
+ run_api(
182
+ host=host,
183
+ port=port,
184
+ api_key=api_key,
185
+ default_provider=default_provider,
186
+ base_url=base_url,
187
+ workers=workers,
188
+ log_level=log_level,
189
+ debug=debug,
190
+ no_auth=no_auth,
191
+ no_rate_limit=no_rate_limit,
192
+ )
193
+
194
+
195
+ def run_api(
196
+ host: str = '0.0.0.0',
197
+ port: int = None,
198
+ api_key: str = None,
199
+ default_provider: str = None,
200
+ base_url: str = None,
201
+ debug: bool = False,
202
+ workers: int = 1,
203
+ log_level: str = 'info',
204
+ show_available_providers: bool = True,
205
+ no_auth: bool = False,
206
+ no_rate_limit: bool = False,
207
+ ) -> None:
208
+ """Run the API server with configuration."""
209
+ print("Starting Webscout OpenAI API server...")
210
+ if port is None:
211
+ port = DEFAULT_PORT
212
+
213
+ AppConfig.set_config(
214
+ api_key=api_key,
215
+ default_provider=default_provider or AppConfig.default_provider,
216
+ base_url=base_url,
217
+ auth_required=not no_auth,
218
+ rate_limit_enabled=not no_rate_limit
219
+ )
220
+
221
+ if show_available_providers:
222
+ if not AppConfig.provider_map:
223
+ initialize_provider_map()
224
+ if not AppConfig.tti_provider_map:
225
+ initialize_tti_provider_map()
226
+
227
+ print("\n=== Webscout OpenAI API Server ===")
228
+ print(f"Server URL: http://{host if host != '0.0.0.0' else 'localhost'}:{port}")
229
+ if AppConfig.base_url:
230
+ print(f"Base Path: {AppConfig.base_url}")
231
+ api_endpoint_base = f"http://{host if host != '0.0.0.0' else 'localhost'}:{port}{AppConfig.base_url}"
232
+ else:
233
+ api_endpoint_base = f"http://{host if host != '0.0.0.0' else 'localhost'}:{port}"
234
+
235
+ print(f"API Endpoint: {api_endpoint_base}/v1/chat/completions")
236
+ print(f"Docs URL: {api_endpoint_base}/docs")
237
+
238
+ # Show authentication status
239
+ if no_auth:
240
+ print(f"Authentication: 🔓 DISABLED (No-Auth Mode)")
241
+ elif api_key:
242
+ print(f"Authentication: 🔐 Legacy API Key")
243
+ else:
244
+ print(f"Authentication: 🔑 Enhanced API Keys")
245
+
246
+ # Show rate limiting status
247
+ if no_rate_limit:
248
+ print(f"Rate Limiting: ⚡ DISABLED")
249
+ else:
250
+ print(f"Rate Limiting: 🛡️ Enabled ({AppConfig.default_rate_limit}/min)")
251
+
252
+ print(f"Default Provider: {AppConfig.default_provider}")
253
+ print(f"Workers: {workers}")
254
+ print(f"Log Level: {log_level}")
255
+ print(f"Debug Mode: {'Enabled' if debug else 'Disabled'}")
256
+
257
+ providers = list(set(v.__name__ for v in AppConfig.provider_map.values()))
258
+ print(f"\n--- Available Providers ({len(providers)}) ---")
259
+ for i, provider_name in enumerate(sorted(providers), 1):
260
+ print(f"{i}. {provider_name}")
261
+
262
+ provider_class_names = set(v.__name__ for v in AppConfig.provider_map.values())
263
+ models = sorted([model for model in AppConfig.provider_map.keys() if model not in provider_class_names])
264
+ if models:
265
+ print(f"\n--- Available Models ({len(models)}) ---")
266
+ for i, model_name in enumerate(models, 1):
267
+ print(f"{i}. {model_name} (via {AppConfig.provider_map[model_name].__name__})")
268
+ else:
269
+ print("\nNo specific models registered. Use provider names as models.")
270
+
271
+ tti_providers = list(set(v.__name__ for v in AppConfig.tti_provider_map.values()))
272
+ print(f"\n--- Available TTI Providers ({len(tti_providers)}) ---")
273
+ for i, provider_name in enumerate(sorted(tti_providers), 1):
274
+ print(f"{i}. {provider_name}")
275
+
276
+ tti_models = sorted([model for model in AppConfig.tti_provider_map.keys() if model not in tti_providers])
277
+ if tti_models:
278
+ print(f"\n--- Available TTI Models ({len(tti_models)}) ---")
279
+ for i, model_name in enumerate(tti_models, 1):
280
+ print(f"{i}. {model_name} (via {AppConfig.tti_provider_map[model_name].__name__})")
281
+ else:
282
+ print("\nNo specific TTI models registered. Use TTI provider names as models.")
283
+
284
+ print("\nUse Ctrl+C to stop the server.")
285
+ print("=" * 40 + "\n")
286
+
287
+ uvicorn_app_str = "webscout.auth.server:create_app_debug" if debug else "webscout.auth.server:create_app"
288
+
289
+ # Configure uvicorn settings
290
+ uvicorn_config = {
291
+ "app": uvicorn_app_str,
292
+ "host": host,
293
+ "port": int(port),
294
+ "factory": True,
295
+ "reload": debug,
296
+ "log_level": log_level.lower() if log_level else ("debug" if debug else "info"),
297
+ }
298
+
299
+ # Add workers only if not in debug mode
300
+ if not debug and workers > 1:
301
+ uvicorn_config["workers"] = workers
302
+ print(f"Starting with {workers} workers...")
303
+ elif debug:
304
+ print("Debug mode enabled - using single worker with reload...")
305
+
306
+ uvicorn.run(**uvicorn_config)
307
+
308
+
309
+ def main():
310
+ """Main entry point for the webscout-server console script."""
311
+ import argparse
312
+
313
+ # Read environment variables with fallbacks
314
+ default_port = int(os.getenv('WEBSCOUT_PORT', os.getenv('PORT', DEFAULT_PORT)))
315
+ default_host = os.getenv('WEBSCOUT_HOST', DEFAULT_HOST)
316
+ default_workers = int(os.getenv('WEBSCOUT_WORKERS', '1'))
317
+ default_log_level = os.getenv('WEBSCOUT_LOG_LEVEL', 'info')
318
+ default_api_key = os.getenv('WEBSCOUT_API_KEY', os.getenv('API_KEY'))
319
+ default_provider = os.getenv('WEBSCOUT_DEFAULT_PROVIDER', os.getenv('DEFAULT_PROVIDER'))
320
+ default_base_url = os.getenv('WEBSCOUT_BASE_URL', os.getenv('BASE_URL'))
321
+ default_debug = os.getenv('WEBSCOUT_DEBUG', os.getenv('DEBUG', 'false')).lower() == 'true'
322
+ default_no_auth = os.getenv('WEBSCOUT_NO_AUTH', 'false').lower() == 'true'
323
+ default_no_rate_limit = os.getenv('WEBSCOUT_NO_RATE_LIMIT', 'false').lower() == 'true'
324
+
325
+ parser = argparse.ArgumentParser(description='Start Webscout OpenAI-compatible API server')
326
+ parser.add_argument('--port', type=int, default=default_port, help=f'Port to run the server on (default: {default_port})')
327
+ parser.add_argument('--host', type=str, default=default_host, help=f'Host to bind the server to (default: {default_host})')
328
+ parser.add_argument('--workers', type=int, default=default_workers, help=f'Number of worker processes (default: {default_workers})')
329
+ parser.add_argument('--log-level', type=str, default=default_log_level, choices=['debug', 'info', 'warning', 'error', 'critical'], help=f'Log level (default: {default_log_level})')
330
+ parser.add_argument('--api-key', type=str, default=default_api_key, help='API key for authentication (optional)')
331
+ parser.add_argument('--default-provider', type=str, default=default_provider, help='Default provider to use (optional)')
332
+ parser.add_argument('--base-url', type=str, default=default_base_url, help='Base URL for the API (optional, e.g., /api/v1)')
333
+ parser.add_argument('--debug', action='store_true', default=default_debug, help='Run in debug mode')
334
+ parser.add_argument('--no-auth', action='store_true', default=default_no_auth, help='Disable authentication (no API keys required)')
335
+ parser.add_argument('--no-rate-limit', action='store_true', default=default_no_rate_limit, help='Disable rate limiting (unlimited requests)')
336
+ args = parser.parse_args()
337
+
338
+ # Print configuration summary
339
+ print(f"Configuration:")
340
+ print(f" Host: {args.host}")
341
+ print(f" Port: {args.port}")
342
+ print(f" Workers: {args.workers}")
343
+ print(f" Log Level: {args.log_level}")
344
+ print(f" Debug Mode: {args.debug}")
345
+ print(f" No-Auth Mode: {'🔓 ENABLED' if args.no_auth else '🔐 Disabled'}")
346
+ print(f" No Rate Limit: {'⚡ ENABLED' if args.no_rate_limit else '🛡️ Disabled'}")
347
+ print(f" API Key: {'Set' if args.api_key else 'Not set'}")
348
+ print(f" Default Provider: {args.default_provider or 'Not set'}")
349
+ print(f" Base URL: {args.base_url or 'Not set'}")
350
+ print()
351
+
352
+ run_api(
353
+ host=args.host,
354
+ port=args.port,
355
+ workers=args.workers,
356
+ log_level=args.log_level,
357
+ api_key=args.api_key,
358
+ default_provider=args.default_provider,
359
+ base_url=args.base_url,
360
+ debug=args.debug,
361
+ no_auth=args.no_auth,
362
+ no_rate_limit=args.no_rate_limit
363
+ )
364
+
365
+
366
+ if __name__ == "__main__":
367
+ main()
webscout/client.py CHANGED
@@ -1,70 +1,121 @@
1
- """
2
- Unified client import for OpenAI-compatible providers and server utilities.
3
-
4
- This module provides a unified import interface for all OpenAI-compatible providers and exposes
5
- helper functions to start the OpenAI-compatible API server programmatically.
6
-
7
- Usage:
8
- from webscout.client import FreeAIChat, AI4Chat, ExaChat, MultiChatAI, TwoAI, SciraChat, ChatSandbox, C4AI, Groq, TypeGPT, LLMChat, Cleeai, DeepInfra, BlackboxAI, Cloudflare, Netwrck, OIVSCode, Venice, Writecream, Wisecat, Yep, X0GPT, Sonus, Toolbaz, TextPollinations, StandardInput, Opkfc, Flowith, ExaAI, FreeGemini, GeminiAPI, Gemini, GithubChat, GizAI, Glider, HeckAI, HuggingFaceChat, Hunyuan, Jadve, Julius, Koala, LearnFast, LearnFastAI, NEMOTRON, MCPCore, PydanticImports, TeachAnything, UncovrAI, API, Base
9
- client = FreeAIChat()
10
- response = client.chat.completions.create(...)
11
-
12
- # To start the server programmatically:
13
- from webscout.client import start_server
14
- start_server()
15
-
16
- # For advanced server control:
17
- from webscout.client import run_api
18
- run_api(host="0.0.0.0", port=8000, debug=True)
19
-
20
- # Instantly start the API server from the command line:
21
- # python -m webscout.client
22
- # or, if installed as a script:
23
- # webscout-api
24
-
25
- Exports:
26
- - All OpenAI-compatible provider classes
27
- - start_server (function): Start the OpenAI-compatible API server with default or custom settings.
28
- - run_api (function): Advanced server startup with full control over host, port, and other options.
29
- """
30
-
31
- from webscout.Provider.OPENAI import *
32
- from webscout.Provider.OPENAI.api import start_server, run_api
33
-
34
- # ---
35
- # API Documentation
36
- #
37
- # start_server
38
- # -------------
39
- # def start_server(port: int = 8000, api_key: str = None, default_provider: str = None, base_url: str = None):
40
- # """
41
- # Start the OpenAI-compatible API server with optional configuration.
42
- #
43
- # Parameters:
44
- # port (int, optional): The port to run the server on. Defaults to 8000.
45
- # api_key (str, optional): API key for authentication. If None, authentication is disabled.
46
- # default_provider (str, optional): The default provider to use. If None, uses the package default.
47
- # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
48
- #
49
- # Returns:
50
- # None
51
- # """
52
- #
53
- # run_api
54
- # -------
55
- # def run_api(host: str = '0.0.0.0', port: int = None, api_key: str = None, default_provider: str = None, base_url: str = None, debug: bool = False, show_available_providers: bool = True):
56
- # """
57
- # Advanced server startup for the OpenAI-compatible API server.
58
- #
59
- # Parameters:
60
- # host (str, optional): Host address to bind the server. Defaults to '0.0.0.0'.
61
- # port (int, optional): Port to run the server on. Defaults to 8000 if not specified.
62
- # api_key (str, optional): API key for authentication. If None, authentication is disabled.
63
- # default_provider (str, optional): The default provider to use. If None, uses the package default.
64
- # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
65
- # debug (bool, optional): Run the server in debug mode with auto-reload. Defaults to False.
66
- # show_available_providers (bool, optional): Print available providers on startup. Defaults to True.
67
- #
68
- # Returns:
69
- # None
70
- # """
1
+ """
2
+ Unified client import for OpenAI-compatible providers and server utilities.
3
+
4
+ This module provides a unified import interface for all OpenAI-compatible providers and exposes
5
+ helper functions to start the OpenAI-compatible API server programmatically.
6
+
7
+ Usage:
8
+ from webscout.client import FreeAIChat, AI4Chat, ExaChat, MultiChatAI, TwoAI, SciraChat, ChatSandbox, C4AI, Groq, TypeGPT, LLMChat, Cleeai, DeepInfra, BlackboxAI, Cloudflare, Netwrck, OIVSCode, Venice, Writecream, Wisecat, Yep, X0GPT, Sonus, Toolbaz, TextPollinations, StandardInput, Opkfc, Flowith, ExaAI, FreeGemini, GeminiAPI, Gemini, GithubChat, GizAI, Glider, HeckAI, HuggingFaceChat, Hunyuan, Jadve, Julius, Koala, LearnFast, LearnFastAI, NEMOTRON, MCPCore, PydanticImports, TeachAnything, UncovrAI, API, Base
9
+ client = FreeAIChat()
10
+ response = client.chat.completions.create(...)
11
+
12
+ # To start the server programmatically:
13
+ from webscout.client import start_server
14
+ start_server()
15
+
16
+ # For advanced server control:
17
+ from webscout.client import run_api
18
+ run_api(host="0.0.0.0", port=8000, debug=True)
19
+
20
+ # Instantly start the API server from the command line:
21
+ # python -m webscout.client
22
+ # or, if installed as a script:
23
+ # webscout-api
24
+
25
+ Exports:
26
+ - All OpenAI-compatible provider classes
27
+ - start_server (function): Start the OpenAI-compatible API server with default or custom settings.
28
+ - run_api (function): Advanced server startup with full control over host, port, and other options.
29
+ """
30
+
31
+ from webscout.Provider.OPENAI import *
32
+
33
+ # Import server utilities from the FastAPI-compatible backend
34
+ try:
35
+ # Use lazy import to avoid module execution issues
36
+ def run_api(*args, **kwargs):
37
+ """Run the Webscout OpenAI-compatible API server (FastAPI backend)."""
38
+ from webscout.auth.server import run_api as _run_api
39
+ return _run_api(*args, **kwargs)
40
+
41
+ def start_server(**kwargs):
42
+ """Start the Webscout OpenAI-compatible API server (FastAPI backend)."""
43
+ from webscout.auth.server import run_api as _run_api
44
+ return _run_api(**kwargs)
45
+ except ImportError:
46
+ # Fallback for environments where the backend is not available
47
+ def run_api(*args, **kwargs):
48
+ raise ImportError("webscout.auth.server.run_api is not available in this environment.")
49
+ def start_server(*args, **kwargs):
50
+ raise ImportError("webscout.auth.server.start_server is not available in this environment.")
51
+
52
+ # ---
53
+ # API Documentation
54
+ #
55
+ # start_server
56
+ # -------------
57
+ # def start_server(
58
+ # port: int = 8000,
59
+ # host: str = "0.0.0.0",
60
+ # api_key: str = None,
61
+ # default_provider: str = None,
62
+ # base_url: str = None,
63
+ # workers: int = 1,
64
+ # log_level: str = 'info',
65
+ # debug: bool = False,
66
+ # no_auth: bool = False,
67
+ # no_rate_limit: bool = False
68
+ # ):
69
+ # """
70
+ # Start the OpenAI-compatible API server with optional configuration.
71
+ #
72
+ # Parameters:
73
+ # port (int, optional): The port to run the server on. Defaults to 8000.
74
+ # host (str, optional): Host address to bind the server. Defaults to '0.0.0.0'.
75
+ # api_key (str, optional): API key for authentication. If None, authentication is disabled.
76
+ # default_provider (str, optional): The default provider to use. If None, uses the package default.
77
+ # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
78
+ # workers (int, optional): Number of worker processes. Defaults to 1.
79
+ # log_level (str, optional): Log level for the server ('debug', 'info', etc.). Defaults to 'info'.
80
+ # debug (bool, optional): Run the server in debug mode with auto-reload. Defaults to False.
81
+ # no_auth (bool, optional): Disable authentication (no API keys required). Defaults to False.
82
+ # no_rate_limit (bool, optional): Disable rate limiting (unlimited requests). Defaults to False.
83
+ #
84
+ # Returns:
85
+ # None
86
+ # """
87
+ #
88
+ # run_api
89
+ # -------
90
+ # def run_api(
91
+ # host: str = '0.0.0.0',
92
+ # port: int = None,
93
+ # api_key: str = None,
94
+ # default_provider: str = None,
95
+ # base_url: str = None,
96
+ # debug: bool = False,
97
+ # workers: int = 1,
98
+ # log_level: str = 'info',
99
+ # show_available_providers: bool = True,
100
+ # no_auth: bool = False,
101
+ # no_rate_limit: bool = False,
102
+ # ) -> None:
103
+ # """
104
+ # Advanced server startup for the OpenAI-compatible API server.
105
+ #
106
+ # Parameters:
107
+ # host (str, optional): Host address to bind the server. Defaults to '0.0.0.0'.
108
+ # port (int, optional): Port to run the server on. Defaults to 8000 if not specified.
109
+ # api_key (str, optional): API key for authentication. If None, authentication is disabled.
110
+ # default_provider (str, optional): The default provider to use. If None, uses the package default.
111
+ # base_url (str, optional): Base URL prefix for the API (e.g., '/api/v1'). If None, no prefix is used.
112
+ # debug (bool, optional): Run the server in debug mode with auto-reload. Defaults to False.
113
+ # workers (int, optional): Number of worker processes. Defaults to 1.
114
+ # log_level (str, optional): Log level for the server ('debug', 'info', etc.). Defaults to 'info'.
115
+ # show_available_providers (bool, optional): Print available providers on startup. Defaults to True.
116
+ # no_auth (bool, optional): Disable authentication (no API keys required). Defaults to False.
117
+ # no_rate_limit (bool, optional): Disable rate limiting (unlimited requests). Defaults to False.
118
+ #
119
+ # Returns:
120
+ # None
121
+ # """