graph LR
G4F_Core_API_Client["G4F Core API & Client"]
Provider_Abstraction_Layer["Provider Abstraction Layer"]
AI_Service_Adapters["AI Service Adapters"]
Web_User_Interface["Web User Interface"]
System_Utilities["System Utilities"]
G4F_Core_API_Client -- "Routes Requests" --> Provider_Abstraction_Layer
Provider_Abstraction_Layer -- "Receives Responses" --> G4F_Core_API_Client
Provider_Abstraction_Layer -- "Delegates Calls" --> AI_Service_Adapters
AI_Service_Adapters -- "Utilizes Services" --> System_Utilities
Web_User_Interface -- "Sends User Input" --> G4F_Core_API_Client
G4F_Core_API_Client -- "Displays AI Output" --> Web_User_Interface
System_Utilities -- "Provides Configuration" --> G4F_Core_API_Client
click G4F_Core_API_Client href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/gpt4free/G4F_Core_API_Client.md" "Details"
click Provider_Abstraction_Layer href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/gpt4free/Provider_Abstraction_Layer.md" "Details"
click AI_Service_Adapters href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/gpt4free/AI_Service_Adapters.md" "Details"
click Web_User_Interface href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/gpt4free/Web_User_Interface.md" "Details"
click System_Utilities href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/gpt4free/System_Utilities.md" "Details"
The gpt4free architecture is centered around a G4F Core API & Client that serves as the primary interface for all interactions, whether from a Python SDK, CLI, or the integrated Web User Interface. This core component intelligently routes AI-related requests to the Provider Abstraction Layer, which acts as a smart orchestrator, selecting the optimal AI Service Adapters to communicate with various third-party or local AI models. All external communications, file operations, and essential configurations are handled by the System Utilities layer, providing a robust and secure foundation for the entire application. This modular design ensures high interoperability, extensibility, and a clear separation of concerns, facilitating both development and deployment of diverse AI capabilities.
G4F Core API & Client [Expand]
The central gateway for all interactions, providing a unified API for programmatic clients (SDK, CLI) and external integrations. It handles request routing, response formatting, and overall orchestration.
Related Classes/Methods:
Provider Abstraction Layer [Expand]
Manages the selection, routing, and standardization of interactions with various AI service providers. It includes the model registry and retry mechanisms.
Related Classes/Methods:
AI Service Adapters [Expand]
Specific implementations for interacting with individual third-party AI APIs (e.g., OpenAI, Gemini) and local models, translating generic requests into provider-specific calls.
Related Classes/Methods:
Web User Interface [Expand]
The browser-based application providing a visual and interactive experience for users to engage with the g4f system, communicating with the G4F Core API & Client backend.
Related Classes/Methods:
System Utilities [Expand]
A foundational layer providing common services such as HTTP communication, file management, cookie handling, web search tools, configuration management, and cryptographic operations.
Related Classes/Methods: