{"id":25983592,"url":"https://github.com/neuralweights/llama-server-authkeys","last_synced_at":"2026-04-20T01:02:09.219Z","repository":{"id":280621147,"uuid":"942602901","full_name":"NeuralWeights/Llama-Server-AuthKeys","owner":"NeuralWeights","description":"Authorization tokens to access llama.cpp server (LM Studio, Ollama, Msty, GPT4All, Jan)","archived":false,"fork":false,"pushed_at":"2025-03-04T11:24:09.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T12:27:56.974Z","etag":null,"topics":["authorization","authorization-server","gpt4all","gpt4all-api","jan","llama","lmstudio","msty","ollama","ollama-api","ollama-app","token-based-authentication"],"latest_commit_sha":null,"homepage":"","language":"Python","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/NeuralWeights.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":"2025-03-04T11:15:31.000Z","updated_at":"2025-03-04T11:24:12.000Z","dependencies_parsed_at":"2025-03-04T12:38:33.296Z","dependency_job_id":null,"html_url":"https://github.com/NeuralWeights/Llama-Server-AuthKeys","commit_stats":null,"previous_names":["neuralweights/llama-server-authkeys"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuralWeights%2FLlama-Server-AuthKeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuralWeights%2FLlama-Server-AuthKeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuralWeights%2FLlama-Server-AuthKeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuralWeights%2FLlama-Server-AuthKeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NeuralWeights","download_url":"https://codeload.github.com/NeuralWeights/Llama-Server-AuthKeys/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242006932,"owners_count":20056683,"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":["authorization","authorization-server","gpt4all","gpt4all-api","jan","llama","lmstudio","msty","ollama","ollama-api","ollama-app","token-based-authentication"],"created_at":"2025-03-05T10:23:31.469Z","updated_at":"2026-04-20T01:02:09.182Z","avatar_url":"https://github.com/NeuralWeights.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Llama Server AuthKeys\r\n\r\n## Overview\r\n\r\nLlama AuthKeys is a lightweight authentication service built with Flask. It provides token management capabilities, including creating, listing, and revoking tokens. The service also proxies requests to an external API while ensuring proper authorization based on token scopes.\r\n\r\n## Features\r\n\r\n- **Token Management**: Create, list, and revoke tokens.\r\n- **Scope-based Authorization**: Tokens have associated scopes that determine access levels.\r\n- **Request Logging**: Logs all incoming requests for auditing purposes.\r\n- **Proxy Requests**: Forwards requests to an external API with proper authentication.\r\n\r\n## Requirements\r\n\r\n- Python 3+\r\n- Flask\r\n- [SQLite3](https://www.sqlite.org/download.html)\r\n\r\n## Installation\r\n\r\n1. Clone the repository:\r\n\r\n   ```bash\r\n   git clone https://github.com/NeuralWeights/llama-server-authkeys.git\r\n   cd llama-server-authkeys\r\n   ```\r\n\r\n2. Install dependencies:\r\n\r\n   ```bash\r\n   pip install flask\r\n   ```\r\n\r\n## Configuration\r\n\r\nAlign the `config.ini` file to your needs if needed.\r\n\r\n```ini\r\n[APP]\r\nhost=127.0.0.1\r\nport=5001\r\n\r\n[DB]\r\ndb_name=authwall.db\r\nroot_token=root\r\n\r\n[INFER]\r\ncompletions=http://localhost:1234/v1/chat/completions\r\nv1=http://localhost:1234/v1\r\n```\r\n\r\n## Running the Application\r\n\r\n1. Start the application:\r\n\r\n   ```bash\r\n   python app.py\r\n   ```\r\n\r\n2. Access the service at `http://localhost:5001`.\r\n\r\n## Usage (CURL)\r\n\r\n### List Tokens\r\n`curl -X GET http://localhost:5001/list_tokens -H \"Content-Type: application/json\" -d \"{\\\"token\\\": \\\"root\\\"}\"`\r\n\r\n### Create Token\r\n`curl -X POST http://localhost:5001/create_token -H \"Content-Type: application/json\" -d \"{\\\"token\\\": \\\"root\\\", \\\"scope\\\": \\\"infer:write\\\", \\\"expired_at\\\": 1756800000}\"`\r\n\r\n### Revoke Token\r\n`curl -X POST http://localhost:5001/revoke_token -H \"Content-Type: application/json\" -d \"{\\\"token\\\": \\\"root\\\", \\\"token_to_revoke\\\": \\\"the_token_to_revoke\\\"}\"`\r\n\r\n### Completions API (Default payload)\r\n`curl -X POST http://localhost:5001/v1/chat/completions -H \"Content-Type: application/json\" -d \"{\\\"token\\\": \\\"your_new_token\\\", \\\"model\\\": \\\"Llama-3.3-70B-instruct\\\", \\\"messages\\\": [{\\\"role\\\": \\\"system\\\", \\\"content\\\": \\\"You are a helpful assistant\\\"}, {\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"Hello\\\"}], \\\"temperature\\\": 0.7}\"`\r\n\r\n### Embeddings API (Default payload)\r\n`curl http://127.0.0.1:5001/v1/embeddings -H \"Content-Type: application/json\" -d \"{ \\\"model\\\": \\\"text-embedding-nomic-embed-text-v1.5\\\", \\\"input\\\": \\\"Some text to embed\\\", \\\"token\\\": \\\"root\\\" }\"`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuralweights%2Fllama-server-authkeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneuralweights%2Fllama-server-authkeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuralweights%2Fllama-server-authkeys/lists"}