Introduction to cloudflare-ai-web
AI Launch Made Easy
Cloudflare-ai-web is an innovative project designed to simplify the deployment and utilization of AI technologies by leveraging the capabilities of Cloudflare Workers AI. This project offers several deployment methods, making it accessible for developers and tech enthusiasts.
Quick Deployment with Vercel
The project provides a convenient one-click deployment option through Vercel, ideal for those looking for a hassle-free setup. By simply cloning the repository using the dedicated button, users can rapidly deploy the project with minimal configuration. All necessary environment variables such as CF_TOKEN
and CF_GATEWAY
are detailed for reference, ensuring users can get started quickly.
Deno Deployment
For those who prefer Deno, the deployment process is straightforward:
- Fork the repository.
- Modify the build step to use
NITRO_PRESET=deno-deploy npm run build_node
. - Deploy the project and configure the required environment variables.
Docker Deployment
Docker users can also deploy cloudflare-ai-web effortlessly. By executing a simple Docker command, users can run the application without worrying about manual setup. The command includes defining environment variables and configuring port settings, ensuring a seamless deploy-to-run experience.
docker run -d --name cloudflare-ai-web \
-e CF_TOKEN=YOUR_CF_TOKEN \
-e CF_GATEWAY=YOUR_CF_GATEWAY \
-p 3000:3000 \
--restart=always \
jazee6/cloudflare-ai-web
Key Features
-
AI Platform Building: Quickly set up a multimodal AI platform using Cloudflare Workers AI, making cutting-edge AI technologies more accessible and integrated.
-
Serverless Deployment: Cloudflare-ai-web supports serverless deployment, eliminating the need for dedicated server infrastructure, thereby reducing overhead costs and complexity.
-
Access Control and Local Storage: Users can enable access passwords and local storage of chat logs to ensure data privacy and security.
-
Lightweight Design: Despite its robust capabilities, the application remains lightweight at approximately 646 kB (gzipped), ensuring efficient performance.
-
Diverse Model Support: The project is compatible with various AI models including
ChatGPT
,Gemini Pro
,Stable Diffusion
,llama-3
, and通义千问
, providing flexibility according to specific needs.
Model Customization
Developers have the freedom to customize model usage by modifying the ./utils/db.ts
file, allowing for the addition or removal of models based on project requirements.
Deployment Guidelines
Environment Variables
The project requires several environment variables for full functionality. Detailed descriptions are provided to assist users in setting up their deployments effectively.
Name | Description |
---|---|
CF_TOKEN | Cloudflare Workers AI Token |
CF_GATEWAY | Cloudflare AI Gateway URL |
OPENAI_API_KEY | Required for ChatGPT |
OPENAI_API_URL | Custom OpenAI API request address |
G_API_KEY | Required for Gemini Pro |
G_API_URL | Google AI proxy settings |
PASSWORD | Optional access password |
Key Setup Instructions
-
CF_TOKEN: Users can acquire their token by creating one through Cloudflare's API tokens page. The process involves selecting the Workers AI Beta template and following the steps to generate and copy the token for environment variable configuration.
-
CF_GATEWAY: Setting up the AI Gateway on Cloudflare requires creating a new gateway and configuring it through the sidebar at Cloudflare's dashboard. The Universal Endpoint generated, minus the trailing slash, is used for deployment settings.
-
G_API_KEY: Users should follow Google's setup guidelines to acquire their API key, necessary for leveraging Google AI functionalities.
-
G_API_URL: For those needing to set up a Google AI proxy, the project includes specific instructions and configurations to facilitate this setup, either through a recommended GitHub repository or by editing
nuxt.config.ts
.
Conclusion
Cloudflare-ai-web is a comprehensive project tailored for those looking to explore or expand into AI-driven platforms. With its multiple deployment options, extensive model support, and straightforward configuration, it presents itself as a highly versatile tool in a developer's arsenal. Whether for hobbyists or professional developers, cloudflare-ai-web offers a robust foundation for building and deploying AI applications with ease.