{"id":13645674,"url":"https://github.com/dvcrn/chatgpt-ui","last_synced_at":"2025-04-06T12:08:25.448Z","repository":{"id":148144408,"uuid":"617234168","full_name":"dvcrn/chatgpt-ui","owner":"dvcrn","description":"ChatGPT UI with auth, OpenAI, Claude, Gemini support, written in Elixir + LiveView","archived":false,"fork":false,"pushed_at":"2025-01-04T10:56:30.000Z","size":4719,"stargazers_count":100,"open_issues_count":5,"forks_count":18,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-30T11:09:23.636Z","etag":null,"topics":["chatgpt","claude-3","elixir","gemini","gemini-pro","liveview","openai","phoenix","phoenix-framework"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvcrn.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}},"created_at":"2023-03-22T00:43:19.000Z","updated_at":"2025-03-19T00:43:09.000Z","dependencies_parsed_at":"2025-02-28T14:17:24.103Z","dependency_job_id":"0a0a419e-c32a-45b4-bcf8-cb4d630cfaa5","html_url":"https://github.com/dvcrn/chatgpt-ui","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcrn%2Fchatgpt-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcrn%2Fchatgpt-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcrn%2Fchatgpt-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcrn%2Fchatgpt-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvcrn","download_url":"https://codeload.github.com/dvcrn/chatgpt-ui/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478322,"owners_count":20945266,"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":["chatgpt","claude-3","elixir","gemini","gemini-pro","liveview","openai","phoenix","phoenix-framework"],"created_at":"2024-08-02T01:02:39.477Z","updated_at":"2025-04-06T12:08:25.426Z","avatar_url":"https://github.com/dvcrn.png","language":"Elixir","funding_links":[],"categories":["Openai","Chat UIs"],"sub_categories":[],"readme":"# ChatGPT UI\n\nChatGPT (or Claude / Gemini Pro) to host yourself, targeted at business-ey usecases that may be useful within a company, written in Elixir + LiveView\n\n![screenshot](screenshot.png)\n\n## What is this?\n\nThe goal is to create a simple ChatGPT UI, for you and your company to self-host.\n\n## Features\n\n- Support for OpenAI GPT4, Google Gemini (through Vertex) and Anthropic Claude models (through bedrock)\n- \"Scenarios\" for repetitive tasks you find yourself doing a lot\n- Use your own OpenAI API key\n- Google OAuth authentication\n- Restrict access to certain email domains\n- Set which model to use\n- Code highlighting with [highlightjs](https://highlightjs.org/)\n- Streaming messages support\n- Dark Mode\n- Automatic content truncating based on token count with [bert-base-multilingual-uncased](https://huggingface.co/bert-base-multilingual-uncased)\n\n## Configuration\n\nIn config.exs, you can set the following keys:\n\n```elixir\nconfig :chatgpt,\n  title: \"Elixir ChatGPT\",\n  enable_google_oauth: true,\n  restrict_email_domains: false,\n  allowed_email_domains: [\"google.com\"]\n\n  default_model: :\"gpt-4\",\n  models: [\n    %{\n      id: :\"anthropic.claude-3-sonnet-20240229-v1:0\",\n      provider: :anthropic,  # \u003c- provider can only be :anthropic, :google or :openai currently\n      truncate_tokens: 100_000,\n      name: \"Claude 3 Sonnet\"\n    },\n    # %{\n    #   id: :\"gemini-1.0-pro\",\n    #   provider: :google,\n    #   truncate_tokens: 100_000,\n    #   name: \"Gemini Pro (Google)\"\n    # },\n    %{\n      id: :\"gpt-4\",\n      provider: :openai,\n      truncate_tokens: 8000,\n      name: \"GPT4\"\n    },\n    %{\n      id: :\"gpt-3.5-turbo-16k\",\n      provider: :openai,\n      truncate_tokens: 15000,\n      name: \"GPT3.5 Turbo 16k\"\n    },\n    %{\n      id: :\"gpt-4-32k\",\n      provider: :openai,\n      truncate_tokens: 30000,\n      name: \"GPT4 32k (EXPENSIVE!)\"\n    }\n  ],\n```\n\nThen in `runtime.exs`:\n\n```elixir\n\n# generate them at https://platform.openai.com/account/api-keys\nconfig :ex_openai,\n  api_key: System.get_env(\"OPENAI_API_KEY\"),\n  organization_key: System.get_env(\"OPENAI_ORGANIZATION_KEY\"),\n  http_options: [recv_timeout: 50_000]\n\n# If you set `enable_google_oauth`, also set the following keys: (by default, uses the environment variables)\n# check https://github.com/dwyl/elixir-auth-google/blob/main/create-google-app-guide.md on how to get these keys\n\nconfig :elixir_auth_google,\n  client_id: System.get_env(\"GOOGLE_AUTH_CLIENT_ID\"),\n  client_secret: System.get_env(\"GOOGLE_AUTH_CLIENT_SECRET\")\n\n# if you want to use AWS Bedrock for Anthropic models\nconfig :chatgpt,\n  access_key_id: System.get_env(\"AWS_ACCESS_KEY_ID\"),\n  secret_access_key: System.get_env(\"AWS_SECRET_ACCESS_KEY\"),\n  region: System.get_env(\"AWS_REGION\")\n```\n\nTo enable google vertex, set the `GOOGLE_APPLICATION_CREDENTIALS_JSON` env variable with the content of your service account credentials. You can also set `GOOGLE_APPLICATION_CREDENTIALS` to the filepath of your service account json file, or use service account based auth when using GKE/GAE.\n\n```\nexport GOOGLE_APPLICATION_CREDENTIALS_JSON='{xxxxx}'\n```\n\n### On Claude support\n\nTo enable Anthropic Claude models, you need to go to AWS Bedrock and request model access for the Claude models.\n\nThen generate a new access key pair to use for authentication\n\n### On Gemini Pro support\n\nTo enable Google's Gemini models, you need to enable the Vertex APIs in the google cloud console.\n\nIf you need to generate a service account credentials json, go into IAM settings, create a new service account, then generate a new key. Important here is that you provide the service account with Vertex permissions.\n\n\n\n## Scenarios\n\n![scenario](scenario.png)\n\nThis UI decided to go with \"scenarios\" instead of the usual \"recent conversations\" approach of the official ChatGPT.\n\n\"Scenarios\" are preconfigured tasks that the AI should do, ready to be bookmarked and used whenever the task needs to be done. These can be things like:\n\n- Rewriting JIRA tickets\n- Grading user stories\n- Explaining code\n- Rephrasing based on corporate language\n\nCurrently, scenarios are set in `scenario.ex` and follow the `%ChatgptWeb.Scenario` struct:\n\n```elixir\n      %{\n        id: \"generate-userstory\",\n        name: \"📗 Generate Userstory\",\n        description:\n          \"Give me the content of a ticket, and I will try to write a user story for you!\",\n        force_model: :\"anthropic.claude-3-sonnet-20240229-v1:0\", # optional, if you want a specific scenario to always go through a specific model. Model has to be in `models` config\n        messages: [\n          %ChatgptWeb.Message{\n            content:\n              \"You are an assistant that generates user stories for tickets. First, take the inputted text and give a summary if the entered text is a good userstory or not, with explanation why.\\nThen, generate a proper user-story with the inputted text in the format of 'As a X, I want to Y, so that I can Z'.\",\n            sender: :system\n          }\n        ],\n        keep_context: false\n      }\n```\n\n- messages are instructions to send to the LLM when the scenario is loaded, typically instructing the AI what it should do. Use `:system` messages to provide admin commands. The 3.5-turbo model is not paying so much attention to system messages, so experiment with using `:user` instead.\n- `keep_context` specifies whether the conversation context should be kept. If this is set to false (recommended), each message that is sent to the AI will be treated as a new conversation, the AI will have no context on previously sent messages.\n\n## Usage\n\nQuick development setup:\n\nFirst, install Elixir 1.14 or higher (1.13 or lower will not work).  Then:\n\n```bash\n# Clone the project\ngit clone https://github.com/dvcrn/chatgpt-ui\ncd chatgpt-ui\n\n# Install Elixir\nmix deps.get\n\n# Install node dependencies\nyarn install      # or npm install\nmix assets.setup\nmix assets.build\n\n# Start the dev server\nexport OPENAI_API_KEY=\u003capi-key\u003e\nexport OPENAI_ORGANIZATION_KEY=\u003corg-key\u003e\nmix phx.server\n```\n\n## Usage / Deploying with Docker\n\nFirst of all, generate a new random keybase: `mix phx.gen.secret`. A default is set, but you should _really_ change this before deploying.\n\n```\ndocker build . -t chatgpt\ndocker run -e SECRET_KEY_BASE=\u003ckeybase here\u003e -e HOST=\"localhost\" -p 4000:4000 chatgpt\n```\n\nThe container (by default) expects the following env vars (unless you changed it in `runtime.exs`):\n\n- HOST\n- PORT (default 4000)\n- SECRET_KEY_BASE\n- OPENAI_API_KEY\n- OPENAI_ORGANIZATION_KEY\n\nAnd if you use google oauth:\n\n- GOOGLE_AUTH_CLIENT_ID\n- GOOGLE_AUTH_CLIENT_SECRET\n\nAnd if you use Anthropic through Bedrock\n- AWS_ACCESS_KEY_ID\n- AWS_REGION\n- AWS_SECRET_ACCESS_KEY\n\nAnd if you use Google Vertex\n\n- GOOGLE_CLOUD_PROJECT_ID\n- GOOGLE_APPLICATION_CREDENTIALS_JSON\n\n## Status\n\nSuper work-in-progress\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvcrn%2Fchatgpt-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvcrn%2Fchatgpt-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvcrn%2Fchatgpt-ui/lists"}