{"repo": "aziontech/bundler-examples", "files": {"examples/ai/hono-ai-sdk/README.md": {"819e95808f4158d0bf3226203a67dc417108aa75": {"t": 1785747273.0936341, "n": 6517, "h": "762f4b18f367ebcc", "c": "# ๐Ÿš€ Hono + AI SDK Multi-Provider Example\n\nA comprehensive [Hono](https://hono.dev/) server implementation showcasing multiple AI providers using the **AI SDK 6.0 Beta**. This project demonstrates text generation, image generation, and audio transcription capabilities across various AI services, deployed on Azion Edge Platform.\n\n## โœจ Features\n\n- ๐Ÿ”„ **Multiple AI Providers** - OpenAI, Deepseek, XAI Grok, Hugging Face, Replicate, Deepgram\n- ๐ŸŒŠ **Streaming Support** - Real-time text streaming with UI message streams\n- ๐ŸŽจ **Image Generation** - AI-powered image creation with Replicate\n- ๐ŸŽต **Audio Transcription** - Speech-to-text with Deepgram\n- โšก **Edge Deployment** - Optimized for Azion Edge Platform\n- ๐Ÿ”’ **Type Safety** - Full TypeScript implementation\n- ๐Ÿงช **Testing Ready** - Comprehensive curl test suite included\n\n## ๐Ÿค– Supported AI Providers\n\n| Provider | Capability | Model | Status |\n|----------|------------|-------|--------|\n| **OpenAI** | Text generation & streaming | GPT-4o | โœ… Active |\n| **Deepseek** | Text generation | deepseek-chat | โœ… Active |\n| **XAI Grok** | Text generation | Grok models | โœ… Active |\n| **Hugging Face** | Text generation | Various models | โœ… Active |\n| **Replicate** | Image generation | Recraft V3 | โœ… Active |\n| **Deepgram** | Audio transcription | Nova-3 | โœ… Active |\n\n## ๐Ÿ› ๏ธ Setup\n\n### 1. **Clone & Install**\n\n```bash\ngit clone \ncd hono-ai-sdk-example\nyarn install\n```\n\n### 2. **Environment Configuration**\n\nCopy the example environment file and add your API keys:\n\n```bash\ncp .env.example .env\n```\n\nUpdate `.env` with your API keys:\n\n```bash\nOPENAI_API_KEY=\"your_openai_api_key\"\nDEEPSEEK_API_KEY=\"your_deepseek_api_key\"\nXAI_API_KEY=\"your_xai_api_key\"\nHUGGINGFACE_API_KEY=\"your_huggingface_api_key\"\nREPLICATE_API_TOKEN=\"your_replicate_token\"\nDEEPGRAM_API_KEY=\"your_deepgram_api_key\"\n```\n\n### 3. **Development**\n\nStart the development server:\n\n```bash\nazion dev\n```\n\nThe server will be available at `http://localhost:3333`\n\n### 4. **Testing**\n\nTest all endpoints using the provided curl commands:\n\n```bash\n# Test health endpoint\ncurl -X GET http://localhost:3333/api/health\n\n# Or use the comprehensive test suite\ncat curl-tests.txt\n```\n\n## ๐Ÿ“ก API Endpoints\n\n### ๐Ÿฅ Health Check\n```bash\nGET /api/health\n```\n**Response:** `\"Hono AI SDK example server is running!\"`\n\n---\n\n### ๐Ÿค– OpenAI Endpoints\n\n#### **UI Message Stream** (Recommended for web apps)\n```bash\nPOST /api/openai\nContent-Type: application/json\n\n{\n \"prompt\": \"Tell me about artificial intelligence\"\n}\n```\n**Returns:** UI Message Stream for real-time updates\n\n#### **Text Stream** (Raw text streaming)\n```bash\nPOST /api/openai/text\nContent-Type: application/json\n\n{\n \"prompt\": \"Write a poem about coding\"\n}\n```\n**Returns:** Plain text stream\n\n#### **Chat Interface** (Conversation format)\n```bash\nPOST /api/openai/chat\nContent-Type: application/json\n\n{\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello, how are you?\"}\n ]\n}\n```\n**Returns:** UI Message Stream with conversation context\n\n#### **Stream with Custom Data** (Advanced streaming)\n```bash\nPOST /api/openai/stream-data\nContent-Type: application/json\n\n{\n \"prompt\": \"Explain quantum computing\"\n}\n```\n**Returns:** UI Message Stream with custom data injection\n\n---\n\n### ๐Ÿง  Other AI Providers\n\n#### **Deepseek** (Text Generation)\n```bash\nPOST /api/deepseek\nContent-Type: application/json\n\n{\n \"prompt\": \"Write a lasagna recipe for 4 people\"\n}\n```\n**Returns:** Plain text response\n\n#### **XAI Grok** (Text Generation)\n```bash\nPOST /api/xai-grok\nContent-Type: application/json\n\n{\n \"prompt\": \"Explain the theory of relativity\"\n}\n```\n**Returns:** Plain text response\n\n#### **Hugging Face** (Text Generation)\n```bash\nPOST /api/huggingface\nContent-Type: application/json\n\n{\n \"prompt\": \"Create a short story about robots\"\n}\n```\n**Returns:** Plain text response\n\n#### **Replicate** (Image Generation)\n```bash\nPOST /api/replicate\nContent-Type: application/json\n\n{\n \"prompt\": \"A futuristic city at sunset\"\n}\n```\n**Returns:** Generated image URL\n\n#### **Deepgram** (Audio Transcription)\n```bash\nPOST /api/deepgram\nContent-Type: application/json\n\n{\n \"audio\": \"https://example.com/audio.mp3\"\n}\n```\n**Returns:** Transcribed text\n\n## ๐Ÿš€ Deployment\n\n### Azion Edge Platform\n\nThis project is optimized for **Azion Edge Platform** deployment:\n\n```bash\n# Deploy to Azion Edge\nazion deploy\n# or\nazion deploy --local\n```\n\n**Configuration:**\n- Entry point: `src/server.ts`\n- Build preset: TypeScript\n- Edge runtime optimized\n- Global CDN distribution\n\n\n## ๐Ÿ› ๏ธ Technologies Used\n\n| Technology | Version | Purpose |\n|------------|---------|---------|\n| **[Hono](https://hono.dev/)** | `4.6.9` | Fast, lightweight web framework |\n| **[AI SDK](https://sdk.vercel.ai/)** | `6.0.0-beta.95` | Vercel's AI toolkit for streaming |\n| **TypeScript** | `5.8.3` | Type safety and developer experience |\n| **Azion Edge** | `1.20.11` | Edge computing platform |\n| **Zod** | `4.1.12` | Runtime type validation |\n\n### AI SDK Providers\n- `@ai-sdk/openai` - OpenAI GPT models\n- `@ai-sdk/deepseek` - Deepseek chat models \n- `@ai-sdk/xai` - XAI Grok models\n- `@ai-sdk/huggingface` - Hugging Face models\n- `@ai-sdk/replicate` - Replicate image generation\n- `@ai-sdk/deepgram` - Deepgram audio transcription\n\n---\n\n## ๐Ÿ“ Project Structure\n\n```\nโ”œโ”€โ”€ ๐Ÿ“ src/\nโ”‚ โ”œโ”€โ”€ ๐Ÿ“ handlers/ # AI provider implementations\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ openai/ # OpenAI GPT-4o streaming & chat\nโ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ index.ts # Main OpenAI routes\nโ”‚ โ”‚ โ”‚ โ””โ”€โ”€ openai-web-search-agent.ts # Web search agent\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ deepseek/ # Deepseek text generation\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ x-ai-grok/ # XAI Grok integration\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ huggingface/ # Hugging Face models\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ replicate/ # Image generation (Recraft V3)\nโ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“ deepgram/ # Audio transcription (Nova-3)\nโ”‚ โ””โ”€โ”€ ๐Ÿ“„ server.ts # Main server & routing configuration\nโ”œโ”€โ”€ ๐Ÿ“ azion/ # Azion deployment configuration\nโ”œโ”€โ”€ ๐Ÿ“„ azion.config.ts # Azion build configuration\nโ”œโ”€โ”€ ๐Ÿ“„ curl-tests.txt # Comprehensive API test suite\nโ”œโ”€โ”€ ๐Ÿ“„ package.json # Dependencies & scripts\nโ”œโ”€โ”€ ๐Ÿ“„ .env.example # Environment variables template\nโ””โ”€โ”€ ๐Ÿ“„ README.md # This documentation\n\n```\n\n---\n\n## ๐Ÿ“„ License\n\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## ๐Ÿ”— Links\n\n- **[Hono Documentation](https://hono.dev/)**\n- **[AI SDK Documentation](https://sdk.vercel.ai/)**\n- **[Azion Edge Platform](https://www.azion.com/)**\n"}, "2d847f63ea56a4049f24795334912611278577df": {"t": 1785772067.5395555, "n": 6517, "h": "762f4b18f367ebcc", "c": "# ๐Ÿš€ Hono + AI SDK Multi-Provider Example\n\nA comprehensive [Hono](https://hono.dev/) server implementation showcasing multiple AI providers using the **AI SDK 6.0 Beta**. This project demonstrates text generation, image generation, and audio transcription capabilities across various AI services, deployed on Azion Edge Platform.\n\n## โœจ Features\n\n- ๐Ÿ”„ **Multiple AI Providers** - OpenAI, Deepseek, XAI Grok, Hugging Face, Replicate, Deepgram\n- ๐ŸŒŠ **Streaming Support** - Real-time text streaming with UI message streams\n- ๐ŸŽจ **Image Generation** - AI-powered image creation with Replicate\n- ๐ŸŽต **Audio Transcription** - Speech-to-text with Deepgram\n- โšก **Edge Deployment** - Optimized for Azion Edge Platform\n- ๐Ÿ”’ **Type Safety** - Full TypeScript implementation\n- ๐Ÿงช **Testing Ready** - Comprehensive curl test suite included\n\n## ๐Ÿค– Supported AI Providers\n\n| Provider | Capability | Model | Status |\n|----------|------------|-------|--------|\n| **OpenAI** | Text generation & streaming | GPT-4o | โœ… Active |\n| **Deepseek** | Text generation | deepseek-chat | โœ… Active |\n| **XAI Grok** | Text generation | Grok models | โœ… Active |\n| **Hugging Face** | Text generation | Various models | โœ… Active |\n| **Replicate** | Image generation | Recraft V3 | โœ… Active |\n| **Deepgram** | Audio transcription | Nova-3 | โœ… Active |\n\n## ๐Ÿ› ๏ธ Setup\n\n### 1. **Clone & Install**\n\n```bash\ngit clone \ncd hono-ai-sdk-example\nyarn install\n```\n\n### 2. **Environment Configuration**\n\nCopy the example environment file and add your API keys:\n\n```bash\ncp .env.example .env\n```\n\nUpdate `.env` with your API keys:\n\n```bash\nOPENAI_API_KEY=\"your_openai_api_key\"\nDEEPSEEK_API_KEY=\"your_deepseek_api_key\"\nXAI_API_KEY=\"your_xai_api_key\"\nHUGGINGFACE_API_KEY=\"your_huggingface_api_key\"\nREPLICATE_API_TOKEN=\"your_replicate_token\"\nDEEPGRAM_API_KEY=\"your_deepgram_api_key\"\n```\n\n### 3. **Development**\n\nStart the development server:\n\n```bash\nazion dev\n```\n\nThe server will be available at `http://localhost:3333`\n\n### 4. **Testing**\n\nTest all endpoints using the provided curl commands:\n\n```bash\n# Test health endpoint\ncurl -X GET http://localhost:3333/api/health\n\n# Or use the comprehensive test suite\ncat curl-tests.txt\n```\n\n## ๐Ÿ“ก API Endpoints\n\n### ๐Ÿฅ Health Check\n```bash\nGET /api/health\n```\n**Response:** `\"Hono AI SDK example server is running!\"`\n\n---\n\n### ๐Ÿค– OpenAI Endpoints\n\n#### **UI Message Stream** (Recommended for web apps)\n```bash\nPOST /api/openai\nContent-Type: application/json\n\n{\n \"prompt\": \"Tell me about artificial intelligence\"\n}\n```\n**Returns:** UI Message Stream for real-time updates\n\n#### **Text Stream** (Raw text streaming)\n```bash\nPOST /api/openai/text\nContent-Type: application/json\n\n{\n \"prompt\": \"Write a poem about coding\"\n}\n```\n**Returns:** Plain text stream\n\n#### **Chat Interface** (Conversation format)\n```bash\nPOST /api/openai/chat\nContent-Type: application/json\n\n{\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello, how are you?\"}\n ]\n}\n```\n**Returns:** UI Message Stream with conversation context\n\n#### **Stream with Custom Data** (Advanced streaming)\n```bash\nPOST /api/openai/stream-data\nContent-Type: application/json\n\n{\n \"prompt\": \"Explain quantum computing\"\n}\n```\n**Returns:** UI Message Stream with custom data injection\n\n---\n\n### ๐Ÿง  Other AI Providers\n\n#### **Deepseek** (Text Generation)\n```bash\nPOST /api/deepseek\nContent-Type: application/json\n\n{\n \"prompt\": \"Write a lasagna recipe for 4 people\"\n}\n```\n**Returns:** Plain text response\n\n#### **XAI Grok** (Text Generation)\n```bash\nPOST /api/xai-grok\nContent-Type: application/json\n\n{\n \"prompt\": \"Explain the theory of relativity\"\n}\n```\n**Returns:** Plain text response\n\n#### **Hugging Face** (Text Generation)\n```bash\nPOST /api/huggingface\nContent-Type: application/json\n\n{\n \"prompt\": \"Create a short story about robots\"\n}\n```\n**Returns:** Plain text response\n\n#### **Replicate** (Image Generation)\n```bash\nPOST /api/replicate\nContent-Type: application/json\n\n{\n \"prompt\": \"A futuristic city at sunset\"\n}\n```\n**Returns:** Generated image URL\n\n#### **Deepgram** (Audio Transcription)\n```bash\nPOST /api/deepgram\nContent-Type: application/json\n\n{\n \"audio\": \"https://example.com/audio.mp3\"\n}\n```\n**Returns:** Transcribed text\n\n## ๐Ÿš€ Deployment\n\n### Azion Edge Platform\n\nThis project is optimized for **Azion Edge Platform** deployment:\n\n```bash\n# Deploy to Azion Edge\nazion deploy\n# or\nazion deploy --local\n```\n\n**Configuration:**\n- Entry point: `src/server.ts`\n- Build preset: TypeScript\n- Edge runtime optimized\n- Global CDN distribution\n\n\n## ๐Ÿ› ๏ธ Technologies Used\n\n| Technology | Version | Purpose |\n|------------|---------|---------|\n| **[Hono](https://hono.dev/)** | `4.6.9` | Fast, lightweight web framework |\n| **[AI SDK](https://sdk.vercel.ai/)** | `6.0.0-beta.95` | Vercel's AI toolkit for streaming |\n| **TypeScript** | `5.8.3` | Type safety and developer experience |\n| **Azion Edge** | `1.20.11` | Edge computing platform |\n| **Zod** | `4.1.12` | Runtime type validation |\n\n### AI SDK Providers\n- `@ai-sdk/openai` - OpenAI GPT models\n- `@ai-sdk/deepseek` - Deepseek chat models \n- `@ai-sdk/xai` - XAI Grok models\n- `@ai-sdk/huggingface` - Hugging Face models\n- `@ai-sdk/replicate` - Replicate image generation\n- `@ai-sdk/deepgram` - Deepgram audio transcription\n\n---\n\n## ๐Ÿ“ Project Structure\n\n```\nโ”œโ”€โ”€ ๐Ÿ“ src/\nโ”‚ โ”œโ”€โ”€ ๐Ÿ“ handlers/ # AI provider implementations\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ openai/ # OpenAI GPT-4o streaming & chat\nโ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ index.ts # Main OpenAI routes\nโ”‚ โ”‚ โ”‚ โ””โ”€โ”€ openai-web-search-agent.ts # Web search agent\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ deepseek/ # Deepseek text generation\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ x-ai-grok/ # XAI Grok integration\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ huggingface/ # Hugging Face models\nโ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“ replicate/ # Image generation (Recraft V3)\nโ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“ deepgram/ # Audio transcription (Nova-3)\nโ”‚ โ””โ”€โ”€ ๐Ÿ“„ server.ts # Main server & routing configuration\nโ”œโ”€โ”€ ๐Ÿ“ azion/ # Azion deployment configuration\nโ”œโ”€โ”€ ๐Ÿ“„ azion.config.ts # Azion build configuration\nโ”œโ”€โ”€ ๐Ÿ“„ curl-tests.txt # Comprehensive API test suite\nโ”œโ”€โ”€ ๐Ÿ“„ package.json # Dependencies & scripts\nโ”œโ”€โ”€ ๐Ÿ“„ .env.example # Environment variables template\nโ””โ”€โ”€ ๐Ÿ“„ README.md # This documentation\n\n```\n\n---\n\n## ๐Ÿ“„ License\n\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## ๐Ÿ”— Links\n\n- **[Hono Documentation](https://hono.dev/)**\n- **[AI SDK Documentation](https://sdk.vercel.ai/)**\n- **[Azion Edge Platform](https://www.azion.com/)**\n"}}}}