GET /v1/models
HTTP API
GET /v1/models
List available models
GET
GET /v1/models
Overview
List available models on the server. This endpoint is compatible with OpenAI’s models API and returns information about the currently loaded model.This endpoint requires authentication if the server was started with
--api-key.Authentication
Bearer token with your API key (required if server started with
--api-key)Format: Bearer YOUR_API_KEYRequest
No request body or parameters required.Response
Object type, always
"list"Array of available model objects
Examples
Basic Request
Response
Using OpenAI Python Client
Using OpenAI Node.js Client
Use Cases
Discovery
Check which model is currently loaded on the server:Validation
Verify the expected model is loaded:Integration Testing
Use in integration tests to ensure correct setup:Client Configuration
Auto-configure client based on available model:Error Responses
401 Unauthorized
Missing or invalid API key:- Missing
Authorizationheader - Incorrect API key
- Wrong authorization format
500 Internal Server Error
Server error (rare):OpenAI Compatibility
This endpoint is fully compatible with OpenAI’s/v1/models endpoint:
- Same request format (no body required)
- Same response structure
- Works with OpenAI client libraries
- Can be used as a drop-in replacement
Differences from OpenAI
Single Model
Single Model
HyperGen always returns a single model (the one loaded at startup), while OpenAI returns multiple models.
Model ID
Model ID
The model ID is the HuggingFace model identifier or local path, not an OpenAI model ID.
Owned By
Owned By
Always returns
"owned_by": "hypergen" instead of OpenAI’s organization names.No Model Details
No Model Details
HyperGen doesn’t provide model capabilities, permissions, or other metadata that OpenAI includes.
Response Fields Reference
Top Level
| Field | Type | Description |
|---|---|---|
object | string | Always "list" |
data | array | Array of model objects (always contains 1 item) |
Model Object
| Field | Type | Description |
|---|---|---|
id | string | Model identifier from server startup |
object | string | Always "model" |
created | integer | Unix timestamp (current time) |
owned_by | string | Always "hypergen" |
Model Identification
The modelid returned matches what was passed to hypergen serve:
Best Practices
Cache Model Information
Cache Model Information
Model information doesn’t change during server lifetime. Cache the response to avoid unnecessary API calls.
Use for Configuration
Use for Configuration
Use the model ID to auto-configure generation parameters based on the model type.
Validation
Validation
Check the model ID at startup to ensure the correct model is loaded before processing requests.
Error Handling
Error Handling
Handle cases where the API is unavailable or returns an unexpected model.
Related Endpoints
Generate Images
Generate images with the loaded model
Health Check
Check server health and status