def __init__(self, url: str, debug: bool = False, **kwargs):
        """Initialize the Upsonic client.
        
        Args:
            url: The server URL to connect to
            debug: Whether to enable debug mode
            **kwargs: Configuration options that match ClientConfig fields
        """
        start_time = time.time()
        self.debug = debug

        # Set server type and URL first
        if "0.0.0.0" in url:
            self.server_type = "Local(Docker)"
        elif "localhost" in url:
            self.server_type = "Local(Docker)"
        elif "upsonic.ai" in url:
            self.server_type = "Cloud(Upsonic)"
        elif "devserver" in url or "localserver" in url:
            self.server_type = "Local(LocalServer)"
        else:
            self.server_type = "Cloud(Unknown)"

        # Handle local server setup
        if url == "devserver" or url == "localserver":
            url = "http://localhost:7541"
            from ..server import run_dev_server, stop_dev_server, is_tools_server_running, is_main_server_running
            if debug:
                run_dev_server(redirect_output=False)
            else:
                run_dev_server(redirect_output=True)

            import atexit
            def exit_handler():
                if is_tools_server_running() or is_main_server_running():
                    stop_dev_server()
            atexit.register(exit_handler)

        # Set URL and default model
        self.url = url
        self.default_llm_model = "openai/gpt-4o"

        # Check if we're in an async context
        try:
            loop = asyncio.get_running_loop()
            in_async_context = True
        except RuntimeError:
            in_async_context = False

        # Check server status before proceeding
        if in_async_context:
            # We're in an async context, but __init__ can't be async
            # We need to run the async method in a new thread
            status_ok = run_coroutine_in_new_thread(self.status_async())
        else:
            # We're not in an async context, use asyncio.run
            status_ok = asyncio.run(self.status_async())
            
        if not status_ok:
            total_time = time.time() - start_time
            connected_to_server(self.server_type, "Failed", total_time)
            raise ServerStatusException("Failed to connect to the server at initialization.")
        
        # Handle configuration through ClientConfig model
        config = ClientConfig(**(kwargs or {}))
        
        # Create a dictionary of non-None values
        config_dict = {
            key: str(value) for key, value in config.model_dump().items() 
            if value is not None
        }
        
        # Bulk set the configurations if there are any
        if config_dict:
            if in_async_context:
                # We're in an async context, but __init__ can't be async
                # We need to run the async method in a new thread
                run_coroutine_in_new_thread(self.bulk_set_config_async(config_dict))
            else:
                # We're not in an async context, use asyncio.run
                asyncio.run(self.bulk_set_config_async(config_dict))

        global latest_upsonic_client
        latest_upsonic_client = self
        total_time = time.time() - start_time
        connected_to_server(self.server_type, "Established", total_time)
Initialize the Upsonic client.
        
        Args:
            url: The server URL to connect to
            debug: Whether to enable debug mode
            **kwargs: Configuration options that match ClientConfig fields
        
src/upsonic/client/base.py