{"id":30278949,"url":"https://github.com/raoeus/drupal-ai-alt-text-generator","last_synced_at":"2026-04-18T04:01:43.509Z","repository":{"id":306155201,"uuid":"1025196340","full_name":"RAOEUS/drupal-ai-alt-text-generator","owner":"RAOEUS","description":"A Drupal AI alt text generator module with human review","archived":false,"fork":false,"pushed_at":"2025-07-24T18:32:11.000Z","size":1206,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-16T14:01:39.951Z","etag":null,"topics":["ai","alt-text-generator","drupal","drupal-10","drupal-10-module","drupal-module"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RAOEUS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-07-23T22:10:47.000Z","updated_at":"2025-07-24T18:32:15.000Z","dependencies_parsed_at":"2025-07-24T01:22:29.952Z","dependency_job_id":"68c48491-1d3f-4e42-b7d0-20c2fc7da768","html_url":"https://github.com/RAOEUS/drupal-ai-alt-text-generator","commit_stats":null,"previous_names":["raoeus/drupal-ai-alt-text-generator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/RAOEUS/drupal-ai-alt-text-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAOEUS%2Fdrupal-ai-alt-text-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAOEUS%2Fdrupal-ai-alt-text-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAOEUS%2Fdrupal-ai-alt-text-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAOEUS%2Fdrupal-ai-alt-text-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RAOEUS","download_url":"https://codeload.github.com/RAOEUS/drupal-ai-alt-text-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAOEUS%2Fdrupal-ai-alt-text-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31955919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","alt-text-generator","drupal","drupal-10","drupal-10-module","drupal-module"],"created_at":"2025-08-16T13:51:30.549Z","updated_at":"2026-04-18T04:01:43.493Z","avatar_url":"https://github.com/RAOEUS.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drupal AI Alt Text Generator Module\n\nProvides AI-generated alt text suggestions for images without alt text in the media library, with a human review workflow. Supports both the cloud-based **OpenAI API** and a self-hosted **Ollama** instance.\n\n-----\n\n## Requirements\n\n  * Drupal 10\n  * PHP 7.4 or higher\n  * PHP extensions: cURL, GD or Imagick\n  * **An API Provider:**\n      * **Option 1 (Cloud):** An OpenAI API key.\n      * **Option 2 (Local):** A running [Ollama](https://ollama.com/) instance with a suitable vision model pulled (e.g., `ollama pull llava:13b`).\n\n-----\n\n## Installation\n\n### 1\\. Via Composer (recommended)\n\nSince this module is not yet on Drupal.org, you first need to add its GitHub repository to your project's `composer.json` file.\n\n1.  **Add the repository to `composer.json`**:\n    In your Drupal project's root `composer.json` file, add the following inside the `repositories` section:\n\n    ```json\n    \"repositories\": [\n        {\n            \"type\": \"composer\",\n            \"url\": \"https://packages.drupal.org/8\"\n        },\n        {\n            \"type\": \"vcs\",\n            \"url\": \"https://github.com/RAOEUS/drupal-ai-alt-text-generator\"\n        }\n    ]\n    ```\n\n2.  **Require the module**:\n    Now you can require the module using its name from the repository. It's recommended to specify a version constraint.\n\n    ```bash\n    composer require raoeus/drupal-ai-alt-text-generator:^1.0\n    ```\n\n3.  **Enable the module**:\n\n    ```bash\n    drush en alt_text_review -y\n    drush cr\n    ```\n\n4.  **Assign permissions**:\n    Assign the **Access Alt Text Review UI** permission to the appropriate roles.\n\n### 2\\. Manual Install\n\n1.  Clone this repository into `web/modules/contrib/alt_text_review`.\n2.  Enable the module and clear caches.\n3.  Assign the **Access Alt Text Review UI** permission.\n\n-----\n\n## Configuration\n\nVisit **Configuration » Media » Alt Text Review Configuration** (`/admin/config/media/alt-text-review`) and configure:\n\n  * **API Provider**: Choose between **OpenAI** (cloud-based) or **Ollama** (self-hosted).\n  * **OpenAI API key**: Required only if you select OpenAI.\n  * **Ollama Hostname**: The address for your local Ollama instance (defaults to `http://localhost:11434`).\n  * **Ollama Model**: The name of the installed vision model to use (e.g., `llava:13b`).\n  * **AI Prompt**: A template for the AI. The token `[max_length]` is replaced by your max-length setting.\n  * **Alt text maximum character length**: An integer value (default 512).\n  * **Enable debug logging**: Logs full request/response payloads to the Drupal logs.\n\n-----\n\n## How It Works\n\n1.  **Discovery**: Finds an image media entity with empty alt text.\n2.  **Downscaling**: Resizes the image to fit within an 800×800 px box to reduce payload size.\n3.  **Encoding**: The downscaled image is base64-encoded.\n4.  **API Call**: The request is sent to your configured provider.\n      * **OpenAI**: Sends a request to the Chat Completions API with the `gpt-4o-mini` model.\n      * **Ollama**: Sends a request to your local `/api/generate` endpoint using your configured Ollama model.\n5.  **Review \u0026 Save**: The form displays the AI suggestion for you to review, edit, and save.\n\n-----\n\n## Cost \u0026 Performance: OpenAI vs. Ollama\n\nYour choice of provider involves a trade-off between pay-per-use convenience and the upfront/operational cost of self-hosting.\n\n### OpenAI (`gpt-4o-mini`)\n\nThis is the simplest option, requiring no hardware management. You pay for what you use. The cost is very low, at approximately **$0.0026 per image**. Processing 10,000 images would cost about **$26**.\n\n### Ollama (Self-Hosted)\n\nThis option is **free of API fees** but requires you to run the model on your own hardware. This is ideal for high-volume processing and enhances data privacy, as images never leave your infrastructure.\n\n#### Recommended Vision Models \u0026 Hardware\n\nThe model you choose depends on the quality you need and the hardware you have available. A GPU is strongly recommended for all but the smallest models.\n\n| Model Name        | Size (Disk) | Min. RAM/VRAM | Best For                                    |\n| ----------------- | ----------- | ------------- | ------------------------------------------- |\n| **`moondream`** | 1.6 GB      | 4 GB          | Fastest, low-resource, basic captions       |\n| **`llava:7b`** | 4.1 GB      | 8 GB          | Good balance of quality and performance     |\n| **`llava:13b`** | 7.4 GB      | 16 GB         | High-quality, detailed descriptions         |\n| **`bakllava`** | 4.1 GB      | 8 GB          | An alternative to `llava:7b`, high performance |\n\nTo install a model, run the corresponding command in your terminal, for example: `ollama pull llava:13b`.\n\n#### Cost Analysis\n\nThe main ongoing cost is electricity. For a mid-range GPU processing 10,000 images, the total electricity cost is typically **less than $1.00**, representing a significant savings over the OpenAI API at scale.\n\n-----\n\n## License\n\nGPL-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraoeus%2Fdrupal-ai-alt-text-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraoeus%2Fdrupal-ai-alt-text-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraoeus%2Fdrupal-ai-alt-text-generator/lists"}