{"id":15169606,"url":"https://github.com/llmapi-io/llmapi-server","last_synced_at":"2025-07-14T15:33:14.870Z","repository":{"id":145117206,"uuid":"613770351","full_name":"llmapi-io/llmapi-server","owner":"llmapi-io","description":"Self-host llmapi server, make it really easy for accessing LLMs ! :rocket:","archived":false,"fork":false,"pushed_at":"2023-04-07T15:12:40.000Z","size":37,"stargazers_count":37,"open_issues_count":1,"forks_count":11,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-11T22:34:05.794Z","etag":null,"topics":["chatgpt","dall-e","embeddings","ernie-bot","gpt-3","gpt-4","gpt3","large-language-models","llama","openapi","welm"],"latest_commit_sha":null,"homepage":"https://llmapi.io","language":"Python","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/llmapi-io.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-14T08:35:41.000Z","updated_at":"2025-02-04T16:27:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"f5ab579c-f17f-417e-9ed9-0e4628c02be8","html_url":"https://github.com/llmapi-io/llmapi-server","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.3571428571428571,"last_synced_commit":"cdae9ca5a9bf2d4df174358f875bc8c9b537b8db"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/llmapi-io/llmapi-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llmapi-io%2Fllmapi-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llmapi-io%2Fllmapi-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llmapi-io%2Fllmapi-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llmapi-io%2Fllmapi-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/llmapi-io","download_url":"https://codeload.github.com/llmapi-io/llmapi-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llmapi-io%2Fllmapi-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265220673,"owners_count":23729859,"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","dall-e","embeddings","ernie-bot","gpt-3","gpt-4","gpt3","large-language-models","llama","openapi","welm"],"created_at":"2024-09-27T07:04:05.820Z","updated_at":"2025-07-14T15:33:14.837Z","avatar_url":"https://github.com/llmapi-io.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"180\" src=\"https://avatars.githubusercontent.com/u/127706964?s=200\u0026v=4\" alt=\"LLMApi Server\"\u003e\n  \u003ch1 align=\"center\"\u003eLLMApi Server\u003c/h1\u003e\n  \u003cp align=\"center\"\u003eSelf-host llmapi server\u003c/p\u003e\n\u003c/p\u003e\n\n## Introdution\n\n[中文文档](README.zh.md)\n\nllmapi-server is an abstract backend that encapsulates a variety of large language models (LLM, such as ChatGPT, GPT-3, GPT-4, etc.), and provides simple access services through OpenAPI\n\n:star2: If it is helpful to you,please star it :star2:\n\n## Diagram\n\n```mermaid\ngraph LR\n\nsubgraph llmapi server\nOpenAPI --\u003e session\nOpenAPI --\u003e pre_post\nsubgraph backend\nstyle backend fill:#f9f\npre_post--\u003echatgpt\npre_post--\u003edall-e\npre_post--\u003ellama\npre_post--\u003e...\nend\nend\ntext--\u003eOpenAPI\nimage--\u003eOpenAPI\nembedding--\u003eOpenAPI\nothers--\u003e OpenAPI\n\n```\n\n## :sparkles: Supportted backends\n- [x] `chatgpt`: openai's official ChatGPT interface\n- [x] `gpt3`: openai's official GPT-3 interface\n- [x] `gpt-embedding`: openai's official Embedding interface\n- [x] `dall-e`: openai's official DALL·E interface\n- [x] `welm`: wechat's llm interface\n- [x] `newbing`: New Bing search based on ChatGPT（unofficial)\n\n\n### ⏳ WIP\n- [ ] llama\n- [ ] stable diffusion\n- [ ] controlNet\n- [ ] SAM(meta)\n\n## Install \u0026 Run\n\n1. run locally\n ``` shell\n# python \u003e= 3.8\npython3 -m pip install -r requirements.txt\n\npython3 run_api_server.py\n```\n\n2. run with docker\n\n``` shell\n./build_docker.sh\n./start_docker.sh\n```\n\n## Visit server\n\n1. Use the `curl` command to access:\n\n``` shell\n# 1. Start a new session\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"bot_type\":\"mock\"}' http://127.0.0.1:5050/v1/chat/start\n# response sample: {\"code\":0,\"msg\":\"Success\",\"session\":\"123456\"}\n\n# 2. chat with LLMs\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"session\":\"123456\",\"content\":\"hello\"}' http://127.0.0.1:5050/v1/chat/ask\n# response sample: {\"code\":0,\"msg\":\"Success\",\"reply\":\"Text mock reply for your prompt:hello\",\"timestamp\":1678865301.0842562}\n\n# 3. Close the session and end chat\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"session\":\"123456\"}' http://127.0.0.1:5050/v1/chat/end\n# response: {\"code\":0,\"msg\":\"Success\"}\n```\n\n2. Using command line tools:[llmapi_cli](https://github.com/llmapi-io/llmapi-cli)\n\n``` shell\nllmapi_cli --host=\"http://127.0.0.1:5050\" --bot=mock\n```\n\n3. Integrate in your python code with llmapi_cli module\n``` python\nfrom llmapi_cli import LLMClient\n\nclient = LLMClient(host = \"http://127.0.0.1:5050\", bot = \"mock\")\n\nrep = client.ask(\"hello\")\n\nprint(rep)\n```\n\n## Plug into your LLM's backend !\n\n1. You need to create a new backend name in the backend directory (assumed to be `newllm`), you can directly `cp -r mock newllm`\n2. Referring to the implementation of `mock`, change the backend name to `newllm`\n3. In the `newllm` directory, add the necessary dependencies, and all related development is bound to this directory\n4. Add support for `newllm` in `backend.py`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllmapi-io%2Fllmapi-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllmapi-io%2Fllmapi-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllmapi-io%2Fllmapi-server/lists"}