summaryrefslogtreecommitdiffstats
path: root/g4f/cli.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-05 23:38:31 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-05 23:38:31 +0200
commit8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c (patch)
treed956ccf9116d4f4db0157c5025dcfbb2a4804487 /g4f/cli.py
parentAdd AppConfig class, update readme (diff)
downloadgpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.gz
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.bz2
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.lz
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.xz
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.tar.zst
gpt4free-8fcf618bbe164e6c6f3e0df5e6c9809f35a50e6c.zip
Diffstat (limited to 'g4f/cli.py')
-rw-r--r--g4f/cli.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/g4f/cli.py b/g4f/cli.py
index fe219b38..408dc914 100644
--- a/g4f/cli.py
+++ b/g4f/cli.py
@@ -11,6 +11,10 @@ def main():
api_parser = subparsers.add_parser("api")
api_parser.add_argument("--bind", default="0.0.0.0:1337", help="The bind string.")
api_parser.add_argument("--debug", action="store_true", help="Enable verbose logging.")
+ api_parser.add_argument("--model", default=None, help="Default model for chat completion. (incompatible with --debug and --workers)")
+ api_parser.add_argument("--provider", choices=[provider.__name__ for provider in Provider.__providers__ if provider.working],
+ default=None, help="Default provider for chat completion. (incompatible with --debug and --workers)")
+ api_parser.add_argument("--proxy", default=None, help="Default used proxy.")
api_parser.add_argument("--workers", type=int, default=None, help="Number of workers.")
api_parser.add_argument("--disable-colors", action="store_true", help="Don't use colors.")
api_parser.add_argument("--ignore-cookie-files", action="store_true", help="Don't read .har and cookie files.")
@@ -31,14 +35,15 @@ def main():
def run_api_args(args):
from g4f.api import AppConfig, run_api
- AppConfig.set_ignore_cookie_files(
- args.ignore_cookie_files
- )
- AppConfig.set_list_ignored_providers(
- args.ignored_providers
- )
- AppConfig.set_g4f_api_key(
- args.g4f_api_key
+ AppConfig.set_config(
+ ignore_cookie_files=args.ignore_cookie_files,
+ ignored_providers=args.ignored_providers,
+ g4f_api_key=args.g4f_api_key,
+ defaults={
+ "model": args.model,
+ "provider": args.provider,
+ "proxy": args.proxy
+ }
)
run_api(
bind=args.bind,