{"id":17599294,"url":"https://github.com/meysamhadeli/codai","last_synced_at":"2025-05-16T18:06:31.411Z","repository":{"id":258402901,"uuid":"872714111","full_name":"meysamhadeli/codai","owner":"meysamhadeli","description":"Codai is an AI code assistant that helps developers through a session-based CLI, providing intelligent code suggestions, refactoring, and code reviews based on the full context of the project.","archived":false,"fork":false,"pushed_at":"2025-03-01T20:57:58.000Z","size":68553,"stargazers_count":326,"open_issues_count":3,"forks_count":17,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-16T18:06:15.686Z","etag":null,"topics":["agent","ai-agents","ai-assistant","anthropic","chatgpt","claude","cli","command-line","deepseek","deepseek-r1","deepseek-v3","gpt-4","gpt-4o","llm","ollama","openai","openrouter","rag","sonnet3-5","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","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/meysamhadeli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-10-15T00:07:32.000Z","updated_at":"2025-05-14T07:31:48.000Z","dependencies_parsed_at":"2024-12-27T06:06:40.636Z","dependency_job_id":"d528de93-1b93-48ae-993c-70803721cab0","html_url":"https://github.com/meysamhadeli/codai","commit_stats":{"total_commits":94,"total_committers":2,"mean_commits":47.0,"dds":"0.010638297872340385","last_synced_commit":"9e012b1b6000b53321b5792301313f98ec4301e4"},"previous_names":["meysamhadeli/codai"],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysamhadeli%2Fcodai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysamhadeli%2Fcodai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysamhadeli%2Fcodai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meysamhadeli%2Fcodai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meysamhadeli","download_url":"https://codeload.github.com/meysamhadeli/codai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582904,"owners_count":22095518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["agent","ai-agents","ai-assistant","anthropic","chatgpt","claude","cli","command-line","deepseek","deepseek-r1","deepseek-v3","gpt-4","gpt-4o","llm","ollama","openai","openrouter","rag","sonnet3-5","terminal"],"created_at":"2024-10-22T10:24:52.918Z","updated_at":"2025-05-16T18:06:31.387Z","avatar_url":"https://github.com/meysamhadeli.png","language":"Go","funding_links":[],"categories":["🚀 AI Tools for Vim, Neovim, and Terminal","Go","CLIs","Coding Copilots","Agent Categories"],"sub_categories":["Terminal \u0026 Command Line Tools","\u003ca name=\"Unclassified\"\u003e\u003c/a\u003eUnclassified"],"readme":"[![CI](https://github.com/meysamhadeli/codai/actions/workflows/ci.yml/badge.svg?branch=main\u0026style=flat-square)](https://github.com/meysamhadeli/codai/actions/workflows/ci.yml)\n![Go Version](https://img.shields.io/badge/go%20version-%3E=1.23-61CFDD.svg?style=flat-square)\n[![Apache License](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](https://github.com/meysamhadeli/codai/blob/main/LICENSE)\n[![Go Reference](https://pkg.go.dev/badge/github.com/meysamhadeli/codai.svg)](https://pkg.go.dev/github.com/meysamhadeli/codai)\n\n# Codai\n\n\u003e 💡 **Codai is an AI code assistant designed to help developers efficiently manage their daily tasks through a session-based CLI, such as adding new features, refactoring,\nand performing detailed code reviews. What makes codai stand out is its deep understanding of the entire context of your project, enabling it to analyze your code base\nand suggest improvements or new code based on your context. This AI-powered tool supports multiple LLM providers, such as OpenAI, DeepSeek, Azure OpenAI, Ollama, Anthropic, and OpenRouter.**\n\n![](./assets/codai-demo.gif)\n\n\n\u003e We use **two** main methods to **manage** and **summarize full context**: \n\n1. **RAG** (Retrieval-Augmented Generation)\n   \n2. **Summarize Full Context of Code with Tree-sitter**.\n\nEach method has its own benefits and is chosen depending on the specific needs of the request. Below is a description of each method.\n\n## 📚 RAG\nThe codai uses **RAG** (Retrieval-Augmented Generation) to **improve code suggestions** by **embedding** and **retrieving the most relevant** information based on\n**user input**. **RAG generates embeddings for the entire code context**, allowing the AI to **dynamically find the most relevant details**. By **connecting** to an **embedding model**,\ncodai **retrieves the just necessary context**, which is then sent with the user’s query to the code-suggestion AI model. This approach **reduces token usage** and provides accurate,\nhelpful responses, making it the recommended method.\n\n## 🌳 Summarize Full Context of Code with Tree-sitter\nAnother approach involves creating a **summary of the full context of project** with **Tree-sitter** and in this approach we just send the **signature body of our code** without **full implementation of code block** to the AI. When a **user requests a specific part of code**,\nthe system can **retrieve the full context for just that section**. This approach also **saves tokens** because it just **sends only completed parts**, but\nit usually uses **slightly more tokens than the RAG method**. In **RAG**, only the **related context send to the AI** for **saving even more tokens**.\n\n\n## 🚀 Get Started\nTo install `codai` globally, you can use the following command:\n\n```bash\ngo install github.com/meysamhadeli/codai@latest\n```\n\n### ⚙️ Set Environment Variables\nTo use codai, you need to set your environment variable for the API key.\n\nFor `Bash`, use:\n```bash\nexport CHAT_API_KEY=\"your_chat_api_key\"\nexport EMBEDDINGS_API_KEY=\"your_embeddings_api_key\"     #(Optional, If you want use RAG.)\n```\n\nFor `PowerShell`, use:\n```powershell\n$env:CHAT_API_KEY=\"your_chat_api_key\"\n$env:EMBEDDINGS_API_KEY=\"your_embeddings_api_key\"     #(Optional, If you want use RAG.) \n```\n### 🔧 Configuration\n`codai` requires a `codai-config.yml` file in the `root of your working directory` or using `environment variables` to set below configs `globally` as a configuration.\n\nThe `codai-config` file should be like following example base on your `AI provider`:\n\n**codai-config.yml**\n```yml\nai_provider_config:\n  chat_provider_name: \"openai\"     # openai | deepseek | ollama | azure-openai | anthropic | openrouter\n  chat_base_url: \"https://api.openai.com\"     # \"https://api.deepseek.com\" | \"http://localhost:11434\" | \"https://test,openai.azure.com\" | \"https://api.anthropic.com\" | \"https://openrouter.ai\"\n  chat_model: \"gpt-4o\"     # \"deepseek-chat\" | \"claude-3-5-sonnet\" | \"llama3.3\"\n  chat_api_version: \"2024-04-01-preview\"     #(Optional, If your AI provider like 'AzureOpenai' or 'Anthropic' has chat api version.)\n  embeddings_provider_name: \"openai\"     # openai | ollama | azure-openai\n  embeddings_base_url: \"https://api.openai.com\" | \"http://localhost:11434\" | \"https://test.openai.azure.com\"\n  embeddings_model: \"text-embedding-3-small\"     #(Optional, If you want use 'RAG'.)\n  embeddings_api_version: \"2024-01-01-preview\"     #(Optional, If your AI provider like 'AzureOpenai' has embeddings api version.)\n  temperature: 0.2     #(Optional, If you want use 'Temperature'.)\n  threshold: 0.2     #(Optional, If you want use 'RAG'.)\n  reasoning_effort: \"low\"     #(Optional, If you want use 'Reasoning'.) \ntheme: \"dracula\"\nrag: true     #(Optional, If you want use 'RAG'.)\n```\n\n\u003e Note: We used the standard integration of [OpenAI APIs](https://platform.openai.com/docs/api-reference/introduction), [Ollama APIs](https://github.com/ollama/ollama/blob/main/docs/api.md), [Azure Openai](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference), [Anthropic](https://docs.anthropic.com/en/api/getting-started), [OpenRouter](https://openrouter.ai/docs/quick-start) and you can find more details in documentation of each AI provider APIs.\n\nIf you wish to customize your configuration, you can create your own `codai-config.yml` file and place it in the `root directory` of `each project` you want to analyze with codai. If `no configuration` file is provided, codai will use the `default settings`.\n\nYou can also specify a configuration file from any directory by using the following CLI command:\n```bash\ncodai code --config ./codai-config.yml\n```\nAdditionally, you can pass configuration options directly in the command line. For example:\n```bash\ncodai code --provider_name openapi --temperature 0.8 --chat_api_key test-chat-key --embeddings_api_key test-embeddings-key\n```\nThis flexibility allows you to customize config of codai on the fly.\n\n\n**.codai-gitignore**\n\nAlso, you can use `.codai-gitignore` in the `root of your working directory,` and codai will ignore the files that we specify in our `.codai-gitignore`.\n\n\u003e Note: We used [Chroma](https://github.com/alecthomas/chroma) for `style` of our `text` and `code block`, and you can find more theme here in [Chroma Style Gallery](https://xyproto.github.io/splash/docs/) and use it as a `theme` in `codai`.\n\n## 🔮 LLM Models\n### ⚡ Best Models\nThe codai works well with advanced LLM models specifically designed for code generation, including `GPT-4o`, `GPT-4`, `deepseek-chat` and `claude-3-5-sonnet`. These models leverage the latest in AI technology, providing powerful capabilities for understanding and generating code, making them ideal for enhancing your development workflow.\n\n### 💻 Local Models\nIn addition to cloud-based models, codai is compatible with local models such as `Ollama`. To achieve the best results, it is recommended to utilize models like [Phi-3-medium instruct (128k)](https://github.com/marketplace/models/azureml/Phi-3-medium-128k-instruct), [Mistral Large (2407)](https://github.com/marketplace/models/azureml-mistral/Mistral-large-2407) and [Meta-Llama-3.1-70B-Instruct](https://github.com/marketplace/models/azureml-meta/Meta-Llama-3-1-70B-Instruct). These models have been optimized for coding tasks, ensuring that you can maximize the efficiency and effectiveness of your coding projects.\n\n### 🌐 OpenAI Embedding Models\nThe codai platform uses `OpenAI embedding models` to retrieve `relevant content` with high efficiency. Recommended models include are **text-embedding-3-large**, **text-embedding-3-small**, and **text-embedding-ada-002**, both known for their `cost-effectiveness` and `accuracy` in `capturing semantic relationships`. These models are ideal for applications needing high-quality performance in `code context retrieval`.\n\n### 🦙 Ollama Embedding Models\ncodai also supports `Ollama embedding models` for `local`, `cost-effective`, and `efficient` embedding generation and `retrieval of relevant content`. Models such as **mxbai-embed-large**, **all-minilm**, and **nomic-embed-text** provide **effective**, **private embedding** creation optimized for high-quality performance. These models are well-suited for `RAG-based retrieval in code contexts`, eliminating the need for external API calls.\n\n## ▶️ How to Run\nTo use `codai` as your code assistant, navigate to the directory where you want to apply codai and run the following command:\n\n```bash\ncodai code\n```\nThis command will initiate the codai assistant to help you with your coding tasks with understanding the context of your code.\n\n## ✨ Features\n\n🧠 Context-aware code completions.\n\n➕ Adding new features or test cases.\n\n🔄 Refactoring code structure and efficiency.\n\n🐛 Describe and suggest fixes for bugs.\n\n✅ Code Review Assistance and optimize code quality.\n\n✔️ Accept and apply AI-generated code changes.\n\n📚 Generate comprehensive documentation.\n\n🌐 Works with multiple programming languages such as (C#, Go, Python, Java, Javascript, Typescript).\n\n⚙️ Adjust settings via a config file.\n\n📊 Maintain understanding of the entire project.\n\n🔍 Retrieve relevant context for accurate suggestions using RAG.\n\n🌳 Summarize Full Project Context using Tree-sitter.\n\n⚡ Support variety of LLM models like GPT-4o, GPT-4, deepseek-chat, claude-3-5-sonnet, and Ollama.\n\n🗂️ Enable the AI to modify several files at the same time.\n\n💳 Track and represent the token consumption for each request.\n\n## 🗺️ Plan\n🌀 This project is a work in progress; new features will be added over time. 🌀\n\nI will try to add new features in the [Issues](https://github.com/meysamhadeli/codai/issues) section of this app.\n\n# 🌟 Support\n\nIf you like my work, feel free to:\n\n- ⭐ this repository. And we will be happy together :)\n\nThanks a bunch for supporting me!\n\n## 🤝 Contribution\n\nThanks to all [contributors](https://github.com/meysamhadeli/codai/graphs/contributors), you're awesome and this wouldn't be possible without you! The goal is to build a categorized, community-driven collection of very well-known resources.\n\nPlease follow this [contribution guideline](./CONTRIBUTION.md) to submit a pull request or create the issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeysamhadeli%2Fcodai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeysamhadeli%2Fcodai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeysamhadeli%2Fcodai/lists"}