Skip to content

ccproxy.cli.main

ccproxy.cli.main

Main entry point for CCProxy API Server.

version_callback

version_callback(value)

Print version and exit.

Source code in ccproxy/cli/main.py
def version_callback(value: bool) -> None:
    """Print version and exit."""
    if value:
        toolkit = get_rich_toolkit()
        toolkit.print(f"ccproxy {__version__}", tag="version")
        raise typer.Exit()

app_main

app_main(ctx, version=False, config=None)

CCProxy API Server - Anthropic and OpenAI compatible interface for Claude.

Source code in ccproxy/cli/main.py
@app.callback()
def app_main(
    ctx: typer.Context,
    version: Annotated[
        bool,
        typer.Option(
            "--version",
            "-V",
            callback=version_callback,
            is_eager=True,
            help="Show version and exit.",
        ),
    ] = False,
    config: Annotated[
        Path | None,
        typer.Option(
            "--config",
            "-c",
            help="Path to configuration file (TOML, JSON, or YAML)",
            exists=True,
            file_okay=True,
            dir_okay=False,
            readable=True,
        ),
    ] = None,
) -> None:
    """CCProxy API Server - Anthropic and OpenAI compatible interface for Claude."""
    # Store config path for commands to use
    ctx.ensure_object(dict)
    ctx.obj["config_path"] = config

    # If no command is invoked, run the serve command by default
    if ctx.invoked_subcommand is None:
        # Import here to avoid circular imports
        from .commands.serve import api

        # Invoke the serve command
        ctx.invoke(api)

main

main()

Entry point for the CLI application.

Source code in ccproxy/cli/main.py
def main() -> None:
    """Entry point for the CLI application."""
    app()