A web application for managing and proxying OpenAI-compatible API endpoints.
Demo:API Pocket
- Endpoint Management: Add, edit, delete, and toggle OpenAI-compatible API endpoints
- API Key Management: Create, manage, and monitor API keys for authentication
- User Authentication: Register, login, and user access control
- OpenAI Compatibility: Acts as a proxy for any OpenAI-compatible API
- Usage Tracking: Monitor API usage statistics and request logs
- Frontend: Next.js, React, Tailwind CSS
- Backend: Next.js API Routes, MongoDB
- Authentication: NextAuth.js
- Database: MongoDB
- Node.js 18+ and npm
- MongoDB instance (local or cloud)
Create a .env file in the root directory with the following variables:
# MongoDB Connection
MONGODB_URI=mongodb://your-mongodb-uri
# NextAuth Configuration
NEXTAUTH_URL=http://127.0.0.1:3000
NEXTAUTH_SECRET=your-random-secret-key
# Google OAuth (Optional)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
- Clone the repository
git clone https://github.com/yourusername/apimanager-nextjs.git
cd apimanager-nextjs- Install dependencies
npm install- Initialize the database (optional)
npm run init-db- Run the development server
npm run dev- Visit
http://localhost:3000in your browser
The main OpenAI-compatible endpoint is:
/v1/chat/completions
This endpoint works exactly like the OpenAI API, accepting the same parameters and providing the same response format.
- Authentication:
/api/auth/*- NextAuth.js authentication endpoints - Endpoint Management:
/api/endpoints/*- Manage API configurations - API Keys:
/api/keys/*- Manage API keys
- Register an account or log in
- Add an OpenAI-compatible API in the Endpoint Management section
- Create API keys for the configured API
- Use the keys to authenticate requests to
/v1/chat/completions
/app- Next.js application and UI components/app/api- API routes and handlers/lib- Shared utilities and database connections/public- Static assets
- Use TypeScript for type safety
- Follow the ESLint configuration
- Use server components where possible
MIT