{"id":22993852,"url":"https://github.com/unb-libraries/aigateway.lib.unb.ca","last_synced_at":"2025-08-25T06:40:09.651Z","repository":{"id":264702672,"uuid":"894143634","full_name":"unb-libraries/aigateway.lib.unb.ca","owner":"unb-libraries","description":"An AI gateway: Manage/Authorize/Filter requests from end-user applications to appropriate inference endpoints.","archived":false,"fork":false,"pushed_at":"2025-03-16T11:30:46.000Z","size":191,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"dev","last_synced_at":"2025-04-02T12:37:43.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/unb-libraries.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-25T20:42:26.000Z","updated_at":"2025-03-16T11:30:50.000Z","dependencies_parsed_at":"2024-11-25T21:35:04.663Z","dependency_job_id":"6ad65f73-d242-4874-a31e-a66435cec788","html_url":"https://github.com/unb-libraries/aigateway.lib.unb.ca","commit_stats":null,"previous_names":["unb-libraries/aigateway.lib.unb.ca"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/unb-libraries/aigateway.lib.unb.ca","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unb-libraries%2Faigateway.lib.unb.ca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unb-libraries%2Faigateway.lib.unb.ca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unb-libraries%2Faigateway.lib.unb.ca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unb-libraries%2Faigateway.lib.unb.ca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unb-libraries","download_url":"https://codeload.github.com/unb-libraries/aigateway.lib.unb.ca/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unb-libraries%2Faigateway.lib.unb.ca/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272014976,"owners_count":24858826,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-15T05:15:15.733Z","updated_at":"2025-08-25T06:40:09.623Z","avatar_url":"https://github.com/unb-libraries.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aigateway.lib.unb.ca\n\u003ccenter\u003e\u003ca href=\"assets/aigateway.png\"\u003e\u003cimg src=\"assets/aigateway.png\" title=\"AI Proxy Diagram\" width=\"720\"\u003e\u003c/a\u003e\u003c/center\u003e\n\n## Overview\naigateway.lib.unb.ca is a Rust-based application that functions as a reverse proxy, channeling incoming HTTP requests from applications to the appropriate inference endpoints.\n\nAs the number of AI-driven applications increases within an organization, the necessity for a centralized proxy to quickly standardize, manage, regulate, and swiftly route requests becomes evident. This application is crafted to be a lightweight, high-performance, and easily configurable solution to this requirement.\n\n## Features\n\n- **Reverse Proxy Requests**: Proxies requests to backend services.\n- **Multiple Endpoints**: Configurable endpoints provide access to necessary inferences.\n- **Key-Based Validation**: API key sets atomic inference endpoint permissions.\n- **Observability**: Detailed, actionable logging can be integrated into observability solutions (currently: NewRelic).\n- **Caching**: Configurable caches reduce latency and enhance performance.\n- **Rate Limiting**: Limits the number of requests to an endpoint to prevent abuse.\n- **Guardrails**: Provides guardrails to mitigate adverse outcomes.\n- **HTTP/2 Support**: Supports HTTP/2.\n\n## Development Status\nThis application is presently under development.\n\n## Configuration\nThe application is configured via a JSON configuration file at `data/config.json`. Below is an example configuration:\n\n```json\n{\n  \"port\": 3000,\n  \"adapter\": \"127.0.0.1\",\n  \"endpoints\": {\n    \"/api/v2\": {\n        \"adapter\": \"deckard_llm_v1\",\n        \"url\": \"http://lib.unb.ca\"\n    }\n  },\n  \"logging\": \"newrelic\",\n  \"license_key\": \"YOURKEY\",\n  \"messages\": {\n    \"auth_failure\": \"Unauthorized or forbidden endpoint access\"\n  }\n}\n```\n\n## Usage\n### Gateway\n#### Generating an Authorization Keypair\nTo create an authorization keypair, use the following command:\n\n```bash\n./gateway generate-key\n```\n\n#### Running the Server\nTo run the server, use the following command:\n\n```bash\n./gateway start-server\n```\n\n## Docker\nA docker image is provided for convenience.\n\n### Client Requests\nThe gateway forwards all data in the POST requests to the configured endpoint while checking the client's authorization credentials in the ```x-pub-key``` and ```x-api-key``` header fields. Example use:\n\n```\ncurl \\\n  -H \"x-pub-key: 2e8db65a-9050-4418-8867-bde29c52618e\" \\\n  -H \"x-api-key: ec6a8c0c-df3c-4ba0-b2d0-32d2fd564afb\" \\\n  -H \"Content-Type: application/json\" \\\n  --request POST \\\n  --data '{\"query\":\"Who was the architect of M. Patrick Gillin Hall\",\"context\":\"\",\"pipeline\":\"libpages\"}' \\\n  https://aigateway.lib.unb.ca/deckard/api/v1\n```\n\n## Logging\n### General\nGeneral logging is printed to stdout/stderr. Verbose logging can be enabled by setting `RUST_LOG=info` in your shell.\n\n### Detailed\nDetailed logging can be sent to [NewRelic](https://newrelic.com/) by setting the `logging` key in the configuration file to `newrelic` and supplying a valid `license_key`.\n\n## License\n- In line with our 'open' ethos, UNB Libraries makes its applications and workflows freely available to everyone whenever possible.\n- As a result, the contents of this repository [unb-libraries/aigateway.lib.unb.ca] are licensed under the [MIT License](http://opensource.org/licenses/mit-license.html). This license explicitly excludes:\n   - Any content that remains the exclusive property of its author(s).\n   - The UNB logo and any associated visual identity assets remain the exclusive property of the University of New Brunswick.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funb-libraries%2Faigateway.lib.unb.ca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funb-libraries%2Faigateway.lib.unb.ca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funb-libraries%2Faigateway.lib.unb.ca/lists"}