-
Notifications
You must be signed in to change notification settings - Fork 155
Description
Motivation
A public endpoint for listing models would improve the developer experience by allowing applications to discover available models before making authenticated requests, similar to how other AI platforms expose their model catalogs.
Current Behavior
The Puter backend does not expose any public (unauthenticated) endpoints for querying available AI chat models. While the AIChatService maintains lists of available models internally, these are only accessible through authenticated driver interfaces.
Reproduction Steps:
- Start the Puter backend server
- Attempt to make an unauthenticated GET request to
/puterai/chat/models(Hint: use curl in your terminal) - Observe: The endpoint does not exist (404 Not Found)
- Review the codebase for any public endpoints that list AI models
- Observe: No such endpoints exist in the current implementation
Expected Behavior
The system should provide public, unauthenticated REST API endpoints that allow anyone to query the available AI chat models. There should be two endpoints: one for a simple list of models, and another for detailed model information including capabilities and cost data.
Acceptance Criteria:
- A new service is created to handle public chat-related API endpoints
- A GET endpoint at
/puterai/chat/modelsreturns a simple list of available AI models without requiring authentication - A GET endpoint at
/puterai/chat/models/detailsreturns detailed information about available models including cost and capability data - The service is properly registered in the CoreModule
- Unit tests verify both endpoints return the correct data from the AIChatService
- The endpoints use appropriate privilege escalation to access system-level model information
Steps To Test
- Start the Puter backend server in development mode
- Make an unauthenticated GET request to
http://localhost:4100/puterai/chat/models - Verify the response contains a JSON object with a
modelsarray listing available AI models - Make an unauthenticated GET request to
http://localhost:4100/puterai/chat/models/details - Verify the response contains detailed model information including cost and capability data
- Run the test suite and verify all new tests pass
Submission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx