Skip to main content

Documentation Index

Fetch the complete documentation index at: https://doc.hitopen.com/llms.txt

Use this file to discover all available pages before exploring further.

The models endpoint returns the list of AI models that are currently available on your Newapi instance. The response format adapts automatically based on your request headers — OpenAI format by default, or Anthropic/Gemini format when the appropriate headers are present.
The list of available models reflects what your administrator has configured. Models that exist in the underlying provider but are not mapped to an active channel will not appear here.

Endpoint

GET https://YOUR_NEWAPI_BASE_URL/v1/models

Request headers

The response format is determined automatically:
ConditionResponse format
x-api-key and anthropic-version headers presentAnthropic format
x-goog-api-key header or key query parameter presentGemini format
All other requestsOpenAI format (default)
For standard usage, send only the Authorization: Bearer header and you will receive the OpenAI format.

Query parameters

key
string
Google API key. When present, the response is returned in Gemini format. Most users should use the Authorization header instead.

Response fields (OpenAI format)

object
string
Always "list".
data
object[]

Examples

curl "https://YOUR_NEWAPI_BASE_URL/v1/models" \
  -H "Authorization: Bearer sk-your-token"

Example response

{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "created": 1715000000,
      "owned_by": "openai"
    },
    {
      "id": "claude-3-5-sonnet-20241022",
      "object": "model",
      "created": 1715000000,
      "owned_by": "anthropic"
    },
    {
      "id": "gemini-2.5-pro",
      "object": "model",
      "created": 1715000000,
      "owned_by": "google"
    }
  ]
}

Error response (401)

{
  "error": {
    "message": "Invalid authentication credentials.",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_api_key"
  }
}