Skip to content

Issue #12 - [FEATURE] Add public endpoint for listing available AI chat models #37

@rogelio-cmj

Description

@rogelio-cmj

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:

  1. Start the Puter backend server
  2. Attempt to make an unauthenticated GET request to /puterai/chat/models (Hint: use curl in your terminal)
  3. Observe: The endpoint does not exist (404 Not Found)
  4. Review the codebase for any public endpoints that list AI models
  5. 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/models returns a simple list of available AI models without requiring authentication
  • A GET endpoint at /puterai/chat/models/details returns 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

  1. Start the Puter backend server in development mode
  2. Make an unauthenticated GET request to http://localhost:4100/puterai/chat/models
  3. Verify the response contains a JSON object with a models array listing available AI models
  4. Make an unauthenticated GET request to http://localhost:4100/puterai/chat/models/details
  5. Verify the response contains detailed model information including cost and capability data
  6. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions