{"id":49109058,"url":"https://github.com/sqliteai/sqlite-ai","last_synced_at":"2026-04-21T03:32:24.600Z","repository":{"id":306036914,"uuid":"1006416252","full_name":"sqliteai/sqlite-ai","owner":"sqliteai","description":"AI-native extension for SQLite that brings on-device inference, embedding generation, and model interaction directly into your database.","archived":false,"fork":false,"pushed_at":"2026-04-01T12:02:55.000Z","size":2928,"stargazers_count":116,"open_issues_count":1,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-04-01T12:05:28.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sqlite.ai","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sqliteai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":null,"dco":null,"cla":null}},"created_at":"2025-06-22T08:07:52.000Z","updated_at":"2026-04-01T12:02:58.000Z","dependencies_parsed_at":"2025-07-23T10:27:40.633Z","dependency_job_id":"f661edda-e2ad-4ea8-b10a-df2b601e3596","html_url":"https://github.com/sqliteai/sqlite-ai","commit_stats":null,"previous_names":["sqliteai/sqlite-ai"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/sqliteai/sqlite-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqliteai","download_url":"https://codeload.github.com/sqliteai/sqlite-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqliteai%2Fsqlite-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32075234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: 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":[],"created_at":"2026-04-21T03:32:23.914Z","updated_at":"2026-04-21T03:32:24.594Z","avatar_url":"https://github.com/sqliteai.png","language":"C","readme":"# SQLite-AI\n\n**SQLite-AI** is an extension for SQLite that brings artificial intelligence capabilities directly into the database. It enables developers to run, fine-tune, and serve AI models from within SQLite using simple SQL queries — ideal for on-device and edge applications where low-latency and offline inference are critical. The extension is actively developed by [SQLite AI](https://sqlite.ai), some API and features are still evolving.\n\n## Features\n\n* **Embedded AI Inference**: Run transformer models directly from SQL queries.\n* **Streaming I/O**: Token-by-token streaming via SQL aggregate functions.\n* **Fine-tuning \u0026 Embedding**: On-device model customization and vector embedding.\n* **Full On-Device Support**: Works on iOS, Android, Linux, macOS, and Windows.\n* **Offline-First**: No server dependencies or internet connection required.\n* **Composable SQL Interface**: AI + relational logic in a single unified layer.\n* **Audio Transcription**: Speech-to-text via Whisper models (WAV, MP3, FLAC).\n* **Vision / Multimodal**: Analyze images via multimodal models (JPG, PNG, BMP, GIF).\n* **Supports any GGUF model**: available on Huggingface; Qwen, Gemma, Llama, DeepSeek and more\n\nSQLite-AI supports **text embedding generation** for search and classification, a **chat-like interface with history and token streaming**, **automatic context save and restore** across sessions, **audio transcription** via Whisper models, and **vision/multimodal** image understanding — making it ideal for building conversational agents, memory-aware assistants, and voice-enabled applications.\n\n## Getting Started\n\n```bash\n# Start SQLite CLI\nsqlite3 myapp.db\n```\n\n```sql\n-- Load the extension\n.load ./ai\n```\n\n### Text Generation\n\n```sql\n-- Load a text generation model\nSELECT llm_model_load('./models/Qwen2.5-3B-Q4_K_M.gguf', 'gpu_layers=99');\nSELECT llm_context_create_textgen();\n\n-- Generate text\nSELECT llm_text_generate('What is the most beautiful city in Italy?');\n```\n\n### Embedding Generation\n\n```sql\n-- Load an embedding model\nSELECT llm_model_load('./models/nomic-embed-text-v1.5-Q8_0.gguf', 'gpu_layers=99');\nSELECT llm_context_create_embedding('embedding_type=FLOAT32');\n\n-- Generate an embedding vector\nSELECT llm_embed_generate('Hello world');\n\n-- Generate an embedding as JSON\nSELECT llm_embed_generate('Hello world', 'json_output=1');\n```\n\n### Chat\n\n```sql\n-- Load a chat model\nSELECT llm_model_load('./models/Llama-3.2-3B-Instruct-Q4_K_M.gguf', 'gpu_layers=99');\nSELECT llm_context_create_chat();\n\n-- Send a message and get a complete response\nSELECT llm_chat_respond('Tell me a joke.');\n\n-- Or stream the reply token by token\nSELECT reply FROM llm_chat('Tell me another joke.');\n```\n\n### Audio Transcription\n\n```sql\n-- Load a Whisper model\nSELECT audio_model_load('./models/ggml-tiny.bin');\n\n-- Transcribe from a file path\nSELECT audio_model_transcribe('./audio/speech.wav');\n\n-- Transcribe with options\nSELECT audio_model_transcribe('./audio/speech.mp3', 'language=it,translate=1');\n\n-- Transcribe from a BLOB column\nSELECT audio_model_transcribe(audio_data) FROM recordings WHERE id = 1;\n```\n\n### Vision / Multimodal\n\n```sql\n-- Load a multimodal model and its vision projector\nSELECT llm_model_load('./models/Gemma-3-4B-IT-Q4_K_M.gguf', 'gpu_layers=99');\nSELECT llm_context_create_textgen();\nSELECT llm_vision_load('./models/mmproj-Gemma-3-4B-IT-f16.gguf');\n\n-- Describe an image\nSELECT llm_text_generate('Describe this image', './photos/cat.jpg');\n\n-- Use vision in a chat conversation\nSELECT llm_context_create_chat();\nSELECT llm_chat_respond('What do you see in this photo?', './photos/landscape.jpg');\n\n-- Analyze multiple images\nSELECT llm_text_generate('Compare these two images', './img1.jpg', './img2.jpg');\n```\n\n## Documentation\n\nFor detailed information on all available functions, their parameters, and examples, refer to the [comprehensive API Reference](./API.md).\n\n## Installation\n\n### Pre-built Binaries\n\nDownload the appropriate pre-built binary for your platform from the official [Releases](https://github.com/sqliteai/sqlite-ai/releases) page:\n\n- Linux: x86 and ARM\n- macOS: x86 and ARM\n- Windows: x86\n- Android\n- iOS\n\n### Loading the Extension\n\n```sql\n-- In SQLite CLI\n.load ./ai\n\n-- In SQL\nSELECT load_extension('./ai');\n```\n\n### Swift Package\n\nYou can [add this repository as a package dependency to your Swift project](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#Add-a-package-dependency). After adding the package, you'll need to set up SQLite with extension loading by following steps 4 and 5 of [this guide](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/platforms/ios.md#4-set-up-sqlite-with-extension-loading).\n\nHere's an example of how to use the package:\n```swift\nimport ai\n\n...\n\nvar db: OpaquePointer?\nsqlite3_open(\":memory:\", \u0026db)\nsqlite3_enable_load_extension(db, 1)\nvar errMsg: UnsafeMutablePointer\u003cInt8\u003e? = nil\nsqlite3_load_extension(db, ai.path, nil, \u0026errMsg)\nvar stmt: OpaquePointer?\nsqlite3_prepare_v2(db, \"SELECT ai_version()\", -1, \u0026stmt, nil)\ndefer { sqlite3_finalize(stmt) }\nsqlite3_step(stmt)\nlog(\"ai_version(): \\(String(cString: sqlite3_column_text(stmt, 0)))\")\nsqlite3_close(db)\n```\n\n### Android Package\n\nAdd the [following](https://central.sonatype.com/artifact/ai.sqlite/ai) to your Gradle dependencies:\n\n```gradle\nimplementation 'ai.sqlite:ai:0.7.55'\n```\n\nHere's an example of how to use the package:\n```java\nSQLiteCustomExtension aiExtension = new SQLiteCustomExtension(getApplicationInfo().nativeLibraryDir + \"/ai\", null);\nSQLiteDatabaseConfiguration config = new SQLiteDatabaseConfiguration(\n    getCacheDir().getPath() + \"/ai_test.db\",\n    SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.OPEN_READWRITE,\n    Collections.emptyList(),\n    Collections.emptyList(),\n    Collections.singletonList(aiExtension)\n);\nSQLiteDatabase db = SQLiteDatabase.openDatabase(config, null, null);\n```\n\n**Note:** Additional settings and configuration are required for a complete setup. For full implementation details, see the [complete Android example](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/android/README.md).\n\n### Python Package\n\nPython developers can quickly get started using the ready-to-use `sqlite-ai` package available on PyPI:\n\n```bash\npip install sqlite-ai\n```\n\nFor usage details and examples, see the [Python package documentation](./packages/python/README.md).\n\n### Flutter Package\n\nAdd the [sqlite_ai](https://pub.dev/packages/sqlite_ai) package to your project:\n\n```bash\nflutter pub add sqlite_ai  # Flutter projects\ndart pub add sqlite_ai     # Dart projects\n```\n\nUsage with `sqlite3` package:\n```dart\nimport 'package:sqlite3/sqlite3.dart';\nimport 'package:sqlite_ai/sqlite_ai.dart';\n\nsqlite3.loadSqliteAiExtension();\nfinal db = sqlite3.openInMemory();\nprint(db.select('SELECT ai_version()'));\n```\n\nFor a complete example, see the [Flutter example](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/examples/flutter/README.md).\n\n---\n\n## License\n\nThis project is licensed under the [Elastic License 2.0](./LICENSE.md). You can use, copy, modify, and distribute it under the terms of the license for non-production use. For production or managed service use, please [contact SQLite Cloud, Inc](mailto:info@sqlitecloud.io) for a commercial license.\n\n---\n\n## Part of the SQLite AI Ecosystem\n\nThis project is part of the **SQLite AI** ecosystem, a collection of extensions that bring modern AI capabilities to the world’s most widely deployed database. The goal is to make SQLite the default data and inference engine for Edge AI applications.\n\nOther projects in the ecosystem include:\n\n- **[SQLite-AI](https://github.com/sqliteai/sqlite-ai)** — On-device inference and embedding generation directly inside SQLite.\n- **[SQLite-Memory](https://github.com/sqliteai/sqlite-memory)** — Markdown-based AI agent memory with semantic search.\n- **[SQLite-Vector](https://github.com/sqliteai/sqlite-vector)** — Ultra-efficient vector search for embeddings stored as BLOBs in standard SQLite tables.\n- **[SQLite-Sync](https://github.com/sqliteai/sqlite-sync)** — Local-first CRDT-based synchronization for seamless, conflict-free data sync and real-time collaboration across devices.\n- **[SQLite-Agent](https://github.com/sqliteai/sqlite-agent)** — Run autonomous AI agents directly from within SQLite databases.\n- **[SQLite-MCP](https://github.com/sqliteai/sqlite-mcp)** — Connect SQLite databases to MCP servers and invoke their tools.\n- **[SQLite-JS](https://github.com/sqliteai/sqlite-js)** — Create custom SQLite functions using JavaScript.\n- **[Liteparser](https://github.com/sqliteai/liteparser)** — A highly efficient and fully compliant SQLite SQL parser.\n\nLearn more at **[SQLite AI](https://sqlite.ai)**.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqliteai%2Fsqlite-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqliteai%2Fsqlite-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqliteai%2Fsqlite-ai/lists"}