{"id":13452970,"url":"https://github.com/nat/openplayground","last_synced_at":"2025-05-12T15:33:53.795Z","repository":{"id":150556608,"uuid":"606913964","full_name":"nat/openplayground","owner":"nat","description":"An LLM playground you can run on your laptop","archived":false,"fork":false,"pushed_at":"2025-03-28T03:03:52.000Z","size":973,"stargazers_count":6346,"open_issues_count":91,"forks_count":490,"subscribers_count":61,"default_branch":"main","last_synced_at":"2025-04-23T17:20:02.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/nat.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-02-26T22:58:17.000Z","updated_at":"2025-04-23T06:46:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"51200c15-e4ab-45fe-9f6a-962751f7c339","html_url":"https://github.com/nat/openplayground","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/nat%2Fopenplayground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nat%2Fopenplayground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nat%2Fopenplayground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nat%2Fopenplayground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nat","download_url":"https://codeload.github.com/nat/openplayground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250477821,"owners_count":21437049,"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":[],"created_at":"2024-07-31T08:00:29.589Z","updated_at":"2025-04-23T17:20:09.073Z","avatar_url":"https://github.com/nat.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Tools","A01_文本生成_文本对话","Chat UIs","others","Tools for Self-Hosting","Open-Source Local LLM Projects","🎮 AI Playgrounds \u0026 API Testing"],"sub_categories":["Open-source projects","大语言对话模型及数据","Running Locally on Windows, MacOS, and Linux:","Notable MCP Servers"],"readme":"# openplayground\n\nAn LLM playground you can run on your laptop.\n\nhttps://user-images.githubusercontent.com/111631/227399583-39b23f48-9823-4571-a906-985dbe282b20.mp4\n\n#### Features\n\n- Use any model from [OpenAI](https://openai.com), [Anthropic](https://anthropic.com), [Cohere](https://cohere.com), [Forefront](https://forefront.ai), [HuggingFace](https://huggingface.co), [Aleph Alpha](https://aleph-alpha.com), [Replicate](https://replicate.com), [Banana](https://banana.dev) and [llama.cpp](https://github.com/ggerganov/llama.cpp).\n- Full playground UI, including history, parameter tuning, keyboard shortcuts, and logprops.\n- Compare models side-by-side with the same prompt, individually tune model parameters, and retry with different parameters.\n- Automatically detects local models in your HuggingFace cache, and lets you install new ones.\n- Works OK on your phone.\n- Probably won't kill everyone.\n\n## Try on nat.dev\n\nTry the hosted version: [nat.dev](https://nat.dev).\n\n## How to install and run\n\n```sh\npip install openplayground\nopenplayground run\n```\n\nAlternatively, run it as a docker container:\n```sh\ndocker run --name openplayground -p 5432:5432 -d --volume openplayground:/web/config natorg/openplayground\n```\n\nThis runs a Flask process, so you can add the typical flags such as setting a different port `openplayground run -p 1235` and others.\n\n## How to run for development\n\n```sh\ngit clone https://github.com/nat/openplayground\ncd app \u0026\u0026 npm install \u0026\u0026 npx parcel watch src/index.html --no-cache\ncd server \u0026\u0026 pip3 install -r requirements.txt \u0026\u0026 cd .. \u0026\u0026 python3 -m server.app\n```\n\n## Docker\n\n```sh\ndocker build . --tag \"openplayground\"\ndocker run --name openplayground -p 5432:5432 -d --volume openplayground:/web/config openplayground\n```\n\nFirst volume is optional. It's used to store API keys, models settings.\n\n## Ideas for contributions\n\n- Add a token counter to the playground\n- Add a cost counter to the playground and the compare page\n- Measure and display time to first token\n- Setup automatic builds with GitHub Actions\n- The default parameters for each model are configured in the `server/models.json` file. If you find better default parameters for a model, please submit a pull request!\n- Someone can help us make a homebrew package, and a dockerfile\n- Easier way to install open source models directly from openplayground, with `openplayground install \u003cmodel\u003e` or in the UI.\n- Find and fix bugs\n- ChatGPT UI, with turn-by-turn, markdown rendering, chatgpt plugin support, etc.\n- We will probably need multimodal inputs and outputs at some point in 2023\n\n### llama.cpp\n\n## Adding models to openplayground\n\nModels and providers have three types in openplayground:\n\n- Searchable\n- Local inference\n- API\n\nYou can add models in `server/models.json` with the following schema:\n\n#### Local inference\n\nFor models running locally on your device you can add them to openplayground like the following (a minimal example):\n\n```json\n\"llama\": {\n    \"api_key\" : false,\n    \"models\" : {\n        \"llama-70b\": {\n            \"parameters\": {\n                \"temperature\": {\n                    \"value\": 0.5,\n                    \"range\": [\n                        0.1,\n                        1.0\n                    ]\n                },\n            }\n        }\n    }\n}\n```\n\nKeep in mind you will need to add a generation method for your model in `server/app.py`. Take a look at `local_text_generation()` as an example.\n\n#### API Provider Inference\n\nThis is for model providers like OpenAI, cohere, forefront, and more. You can connect them easily into openplayground (a minimal example):\n\n```json\n\"cohere\": {\n    \"api_key\" : true,\n    \"models\" : {\n        \"xlarge\": {\n            \"parameters\": {\n                \"temperature\": {\n                    \"value\": 0.5,\n                    \"range\": [\n                        0.1,\n                        1.0\n                    ]\n                },\n            }\n        }\n    }\n}\n```\n\nKeep in mind you will need to add a generation method for your model in `server/app.py`. Take a look at `openai_text_generation()` or `cohere_text_generation()` as an example.\n\n#### Searchable models\n\nWe use this for Huggingface Remote Inference models, the search endpoint is useful for scaling to N models in the settings page.\n\n```json\n\"provider_name\": {\n    \"api_key\": true,\n    \"search\": {\n        \"endpoint\": \"ENDPOINT_URL\"\n    },\n    \"parameters\": {\n        \"parameter\": {\n            \"value\": 1.0,\n            \"range\": [\n                0.1,\n                1.0\n            ]\n        },\n    }\n}\n```\n\n#### Credits\n\nInstigated by Nat Friedman. Initial implementation by [Zain Huda](https://github.com/zainhuda) as a repl.it bounty. Many features and extensive refactoring by [Alex Lourenco](https://github.com/AlexanderLourenco).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnat%2Fopenplayground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnat%2Fopenplayground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnat%2Fopenplayground/lists"}