{"id":18947655,"url":"https://github.com/pedcapa/autogpt-api","last_synced_at":"2026-05-10T06:34:46.480Z","repository":{"id":252501286,"uuid":"826561052","full_name":"pedcapa/autogpt-api","owner":"pedcapa","description":"A unified API built with Go and Fiber for interacting with language models from OpenAI, Google, and Anthropic, with usage tracking and cost management via MongoDB.","archived":false,"fork":false,"pushed_at":"2024-08-26T05:58:18.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-01T01:20:27.625Z","etag":null,"topics":["ai","anthropic","api","claude","fiber","gemini","golang","gpt","language-model","mongodb","openai"],"latest_commit_sha":null,"homepage":"","language":"Go","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/pedcapa.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":"2024-07-10T00:26:39.000Z","updated_at":"2024-08-26T05:58:21.000Z","dependencies_parsed_at":"2024-08-10T09:21:02.553Z","dependency_job_id":"6105b7ec-60cb-467a-af51-730eec993ad1","html_url":"https://github.com/pedcapa/autogpt-api","commit_stats":null,"previous_names":["pedcapa/autogpt-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedcapa%2Fautogpt-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedcapa%2Fautogpt-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedcapa%2Fautogpt-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedcapa%2Fautogpt-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedcapa","download_url":"https://codeload.github.com/pedcapa/autogpt-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239946876,"owners_count":19723014,"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":["ai","anthropic","api","claude","fiber","gemini","golang","gpt","language-model","mongodb","openai"],"created_at":"2024-11-08T13:10:49.681Z","updated_at":"2026-05-10T06:34:46.437Z","avatar_url":"https://github.com/pedcapa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoGPT API\n\n## Overview\n\nAutoGPT API is a powerful and scalable API built with Go and Fiber. It allows seamless interaction with various large language models (LLMs) from top providers like OpenAI, Google, and Anthropic. The API tracks usage and manages costs associated with these services, storing data in MongoDB for detailed analysis and auditing.\n\n## Features\n\n- **Unified API**: Interact with multiple LLM providers (OpenAI, Google, Anthropic) through a single, easy-to-use API.\n- **Usage Tracking**: Automatically tracks token usage and associated costs for each user.\n- **Cost Management**: Helps in managing and understanding the costs incurred from using different models.\n- **Flexible and Extensible**: Easily add new models or providers by updating the `models.json` configuration.\n- **Built with Fiber**: High-performance web framework for Go, with built-in middleware and utilities.\n- **MongoDB Integration**: Stores all user data, usage history, and cost information in MongoDB for persistence and querying.\n\n## Getting Started\n\n### Prerequisites\n\n- Go 1.19 or later\n- MongoDB instance, accessible via a connection string set in the `MONGODB_URI` environment variable\n- API keys for OpenAI, Google Gemini, and Anthropic Claude\n\n### Installation\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/pedcapa/autogpt-api.git\n   cd autogpt-api\n   ```\n\n2. **Install dependencies:**\n\n   ```bash\n   go mod tidy\n   ```\n\n3. **Set environment variables:**\n\n   Ensure you have the following environment variables set:\n   - `MONGODB_URI`: The connection string for your MongoDB instance.\n   - `OPENAI_API_KEY`\n   - `GEMINI_API_KEY`\n   - `CLAUDE_API_KEY`\n\n   You can set these in your terminal session:\n\n   ```bash\n   export MONGODB_URI=your_mongodb_uri\n   export OPENAI_API_KEY=your_openai_key\n   export GEMINI_API_KEY=your_google_key\n   export CLAUDE_API_KEY=your_anthropic_key\n   ```\n\n4. **Run the API:**\n\n   ```bash\n   go run main.go\n   ```\n\n   The API will start on port `8080` by default.\n\n### Usage\n\nThe API provides endpoints to interact with language models from different providers:\n\n- **OpenAI**: `/openai`\n- **Google**: `/google`\n- **Anthropic**: `/anthropic`\n- **Whisper**: `/whisper` (under development)\n- **Brain**: `/brain` (under development)\n\nExample of a POST request to OpenAI:\n\n```bash\ncurl -X POST http://localhost:8080/openai \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\n           \"id_user\": \"pedro\",\n           \"model\": \"gpt-4o-mini\",\n           \"messages\": [\n             {\n               \"role\": \"system\",\n               \"content\": \"You are a helpful assistant.\"\n             },\n             {\n               \"role\": \"user\",\n               \"content\": \"Who won the world series in 2020?\"\n             },\n             {\n               \"role\": \"assistant\",\n               \"content\": \"The Los Angeles Dodgers won the World Series in 2020.\"\n             },\n             {\n               \"role\": \"user\",\n               \"content\": \"Where was it played?\"\n             }\n           ]\n         }'\n```\n\n### Contributing\n\nContributions are currently not available, but we are working on setting up the contribution guidelines and infrastructure. Stay tuned for updates!\n\n### License\n\nThis project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for details.\n\n### Contact\n\nFor questions or support, please [contact me](mailto:pedro@galliard.mx).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedcapa%2Fautogpt-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedcapa%2Fautogpt-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedcapa%2Fautogpt-api/lists"}