{"id":30760618,"url":"https://github.com/louisbrulenaudet/genai-api","last_synced_at":"2026-05-05T19:31:53.540Z","repository":{"id":312594783,"uuid":"1043651430","full_name":"louisbrulenaudet/genai-api","owner":"louisbrulenaudet","description":"Supercharge your applications using Cloudflare Workers and Gemini within minutes (and for free, up to hundreds of requests per day) ☁️✨","archived":false,"fork":false,"pushed_at":"2026-04-05T09:33:33.000Z","size":1718,"stargazers_count":107,"open_issues_count":6,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-05T11:21:36.230Z","etag":null,"topics":["ai","ai-gateway","ai-studio","api","apple-shortcuts","cloudflare","cloudflare-workers","gemini","genai","generative-ai","google-ai-studio","hacktoberfest","hono","llm","nlp","shortcuts","wrangler","zod"],"latest_commit_sha":null,"homepage":"https://producthunt.com/products/genai-api-for-apple-shortcuts","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/louisbrulenaudet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"louisbrulenaudet"}},"created_at":"2025-08-24T10:28:58.000Z","updated_at":"2026-04-05T09:33:37.000Z","dependencies_parsed_at":"2025-08-31T20:24:26.384Z","dependency_job_id":"6a3dfc76-42c8-4b72-89a3-a0d36cf82e3c","html_url":"https://github.com/louisbrulenaudet/genai-api","commit_stats":null,"previous_names":["louisbrulenaudet/genai-api"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/louisbrulenaudet/genai-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisbrulenaudet%2Fgenai-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisbrulenaudet%2Fgenai-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisbrulenaudet%2Fgenai-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisbrulenaudet%2Fgenai-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/louisbrulenaudet","download_url":"https://codeload.github.com/louisbrulenaudet/genai-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisbrulenaudet%2Fgenai-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32664815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-gateway","ai-studio","api","apple-shortcuts","cloudflare","cloudflare-workers","gemini","genai","generative-ai","google-ai-studio","hacktoberfest","hono","llm","nlp","shortcuts","wrangler","zod"],"created_at":"2025-09-04T13:02:24.919Z","updated_at":"2026-05-05T19:31:53.535Z","avatar_url":"https://github.com/louisbrulenaudet.png","language":"TypeScript","funding_links":["https://github.com/sponsors/louisbrulenaudet"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/thumbnail.png\" alt=\"Bodyboard Thumbnail\" height=\"150\" draggable=\"false\" /\u003e\n\u003c/p\u003e\n\n# Supercharge your applications using Cloudflare Worker and Gemini within minutes ☁️✨\n\n[![Biome](https://img.shields.io/badge/lint-biome-blue?logo=biome)](https://biomejs.dev/)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)\n[![Known Vulnerabilities](https://snyk.io/test/github/louisbrulenaudet/genai-api/badge.svg)](https://snyk.io/test/github/louisbrulenaudet/genai-api)\n[![Zod](https://img.shields.io/badge/validation-zod-blueviolet?logo=zod)](https://github.com/colinhacks/zod)\n\nThis TypeScript API built with [Hono](https://hono.dev/), [OpenAI](https://openai.com/), and deployed as a Cloudflare Worker aims originally to boost the performance of Apple's Shortcuts by providing a seamless integration with generative AI capabilities, allowing users to create more powerful and intelligent shortcuts and leveraging the full potential of information extraction provided by the Apple ecosystem. Nowadays, it can now be used to supercharge any application by providing a seamless integration with generative AI capabilities.\n\nThe objective of this repo is to provide a very simple and easy-to-use API for developers to integrate generative AI capabilities into their shortcuts in a minute. You just have to download this repository, slightly edit the configuration files, notably the `wrangler.jsonc` file, and run `make init` (eventually `make update`), then:\n\n```bash\nwrangler secret put GOOGLE_AI_STUDIO_API_KEY\n```\n\nWrangler will prompt you to enter your API key, which will be securely stored as a secret environment variable in your Cloudflare Worker. If you don't have an API key yet, you can get one from the [Google AI Studio](https://aistudio.google.com/apikey).\n\nThen, you need to put a bearer token for security reasons:\n\n```bash\nwrangler secret put BEARER_TOKEN\n```\n\nOnce you have set up the secrets, you can deploy the API to Cloudflare Workers using:\n\n```bash\nmake deploy\n```\n\nHere you go! Your API is now deployed and ready to use. You can test it by sending requests to the Cloudflare Workers URL provided in the output. The `completion` endpoint must be accessible pinging something like `https://your-cloudflare-worker-url.com/api/v1/completion`.\n\n## API Usage\n\n### Providers \u0026 Models\n\n- **Providers:** `google-ai-studio`\n- **Models:** `gemini-2.5-flash`, `gemini-2.5-flash-lite`, `gemini-2.0-flash`, `gemini-2.0-flash-lite`\n\n### POST `/completion`\n\nThe API supports both text and image input (multimodal). You can send images (as data URLs) alongside text in your requests, enabling advanced use cases such as visual question answering, image captioning, and more.\n\nSend a POST request to `/completion` with a JSON body:\n\n```http\nPOST /completion\nContent-Type: application/json\nAuthorization: Bearer your_token\nX-API-Key: your_provider_specific_api_key\n\n{\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are a helpful assistant.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"What is in this image?\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...\"\n        }\n      ]\n    }\n  ],\n  \"temperature\": 0.7,\n  \"model\": \"gemini-2.0-flash\"\n}\n```\n\nOr, with only text:\n\n```http\nPOST /completion\nContent-Type: application/json\nAuthorization: Bearer your_token\nX-API-Key: your_provider_specific_api_key\n\n{\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"What is the capital of France?\"\n    }\n  ]\n}\n```\n\n#### Request Parameters\n\n- `messages` (array, required): List of message objects, each with:\n  - `role` (string, required): One of `\"system\"`, `\"user\"`, `\"assistant\"`, `\"developer\"`.\n  - `content` (string or array, required): Either a string (text) or an array of content blocks:\n    - Text block: `{ \"type\": \"text\", \"text\": \"...\" }`\n    - Image block: `{ \"type\": \"image_url\", \"image_url\": \"\u003cdata URL\u003e\" }`\n      - **Image must be a valid data URL.**\n- `temperature` (number, optional): Sampling temperature (default 0.2, range 0–2).\n- `provider` (string, optional): Provider name (default: `google-ai-studio`).\n- `model` (string, optional): Model name (default: `gemini-2.5-flash`).\n- `reasoning_effort` (string, optional): Reasoning effort level.\n\nThe response will be plain text with the model's completion.\n\nApple provide a helpful guide [here](https://support.apple.com/fr-fr/guide/shortcuts/apd58d46713f/ios) that you can follow to create your first shortcut using API calls.\n\n**Authentication:**\n- Always include the `Authorization` header with your Bearer token.\n- You may also send an `X-API-Key` header to use a provider-specific key for requests, without needing to rotate secrets in environment variables.\n\nWithout the `Authorization` header, the request will fail.\n\n### Development\n\nIf you want to contribute to the development of this API or simply run it locally, you can follow these steps:\n\n1. Clone the repository:\n\n```sh\ngit clone https://github.com/louisbrulenaudet/genai-api.git\ncd genai-api\n```\n\n2. Install dependencies:\n\n```sh\nmake init\n```\n\n3. Set up environment variables in `.dev.vars`:\n\n```sh\nCLOUDFLARE_AI_GATEWAY_BASE_URL=https://gateway.ai.cloudflare.com/v1\nCLOUDFLARE_ACCOUNT_ID=your_account_id\nCLOUDFLARE_AI_GATEWAY_ID=your_cloudflare_ai_gateway_id\nGOOGLE_AI_STUDIO_API_KEY=your_api_key\nBEARER_TOKEN=your_bearer_token\n```\n\n4. Start the development server:\n\n```sh\nmake dev\n```\n\nThe API runs locally on port 8788.\n\n## Makefile Commands\n\n| Command   | Description                                 |\n|-----------|---------------------------------------------|\n| init      | Initialize the project                      |\n| update    | Update dependencies                         |\n| dev       | Run development server                      |\n| deploy    | Deploy the application                      |\n| format    | Format codebase with Biome                  |\n| lint      | Lint codebase with Biome                    |\n| types     | Generate TypeScript worker types            |\n| cloc      | Count lines of code in src/                 |\n\n## Feedback\nIf you have any feedback, please reach out at [louisbrulenaudet@icloud.com](mailto:louisbrulenaudet@icloud.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisbrulenaudet%2Fgenai-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouisbrulenaudet%2Fgenai-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisbrulenaudet%2Fgenai-api/lists"}