CodeGate provides a command-line interface through cli.py
with the following
structure:
codegate [OPTIONS] COMMAND [ARGS]...
Start the CodeGate server:
codegate serve [OPTIONS]
-
--port INTEGER
: Port to listen on (default:8989
)- Must be between 1 and 65535
- Overrides configuration file and environment variables
-
--host TEXT
: Host to bind to (default:localhost
)- Overrides configuration file and environment variables
-
--log-level [ERROR|WARNING|INFO|DEBUG]
: Set the log level (default:INFO
)- Optional
- Case-insensitive
- Overrides configuration file and environment variables
-
--log-format [JSON|TEXT]
: Set the log format (default:JSON
)- Optional
- Case-insensitive
- Overrides configuration file and environment variables
-
--config FILE
: Path to YAML config file- Optional
- Must be a valid YAML file
- Configuration values can be overridden by environment variables and CLI options
-
--prompts FILE
: Path to YAML prompts file- Optional
- Must be a valid YAML file
- Overrides default prompts and configuration file prompts
-
--vllm-url TEXT
: vLLM provider URL (default:http://localhost:8000
)- Optional
- Base URL for vLLM provider (/v1 path is added automatically)
- Overrides configuration file and environment variables
-
--openai-url TEXT
: OpenAI provider URL (default:https://api.openai.com/v1
)- Optional
- Base URL for OpenAI provider
- Overrides configuration file and environment variables
-
--anthropic-url TEXT
: Anthropic provider URL (default:https://api.anthropic.com/v1
)- Optional
- Base URL for Anthropic provider
- Overrides configuration file and environment variables
-
--ollama-url TEXT
: Ollama provider URL (default:http://localhost:11434
)- Optional
- Base URL for Ollama provider (/api path is added automatically)
- Overrides configuration file and environment variables
-
--model-base-path TEXT
: Base path for loading models needed for the system- Optional
-
--embedding-model TEXT
: Name of the model used for embeddings- Optional
-
--db-path TEXT
: Path to a SQLite DB. Will be created if it doesn't exist. (default:./codegate_volume/db/codegate.db
)- Optional
- Overrides configuration file and environment variables
Display the loaded system prompts:
codegate show-prompts [OPTIONS]
--prompts FILE
: Path to YAML prompts file- Optional
- Must be a valid YAML file
- If not provided, shows default prompts from
prompts/default.yaml
Generate certificates for the CodeGate server.
codegate generate-certs [OPTIONS]
-
--certs-out-dir PATH
: Directory path where the certificates are generated (default: ./codegate_volume/certs)- Optional
- Overrides configuration file and environment variables
-
--ca-cert-name TEXT
: Name that will be given to the created CA certificate (default: ca.crt)- Optional
- Overrides configuration file and environment variables
-
--ca-key-name TEXT
: Name that will be given to the created CA key (default: ca.key)- Optional
- Overrides configuration file and environment variables
-
--server-cert-name TEXT
: Name that will be given to the created server certificate (default: server.crt)- Optional
- Overrides configuration file and environment variables
-
--server-key-name TEXT
: Name that will be given to the created server key (default: server.key)- Optional
- Overrides configuration file and environment variables
-
--log-level [ERROR|WARNING|INFO|DEBUG]
: Set the log level (default: INFO)- Optional
- Case-insensitive
- Overrides configuration file and environment variables
-
--log-format [JSON|TEXT]
: Set the log format (default: JSON)- Optional
- Case-insensitive
- Overrides configuration file and environment variables
The CLI provides user-friendly error messages for:
- Invalid port numbers
- Invalid log levels
- Invalid log formats
- Configuration file errors
- Prompts file errors
- Server startup failures
All errors are output to stderr with appropriate exit codes.
Start server with default settings:
codegate serve
Start server on specific port and host:
codegate serve --port 8989 --host localhost
Start server with custom logging:
codegate serve --log-level DEBUG --log-format TEXT
Start server with configuration file:
codegate serve --config my-config.yaml
Start server with custom prompts:
codegate serve --prompts my-prompts.yaml
Start server with custom vLLM endpoint:
codegate serve --vllm-url https://vllm.example.com
Start server with custom Ollama endpoint:
codegate serve --ollama-url http://localhost:11434
Show default system prompts:
codegate show-prompts
Show prompts from a custom file:
codegate show-prompts --prompts my-prompts.yaml
Generate certificates with default settings:
codegate generate-certs