Skip to main content

GET /api/tags

Retrieve a list of all available models based on configured providers. Only models whose providers have valid API keys configured will be returned.

Request

This endpoint accepts no parameters. Simply send a GET request:
curl http://localhost:11434/api/tags

Response

models
array
Array of available model objects.
models[].name
string
The model identifier used in API requests.
models[].model
string
The model name (same as name).
models[].modified_at
string
ISO 8601 timestamp (generated at request time for compatibility).
models[].size
number
Model size in bytes (placeholder value: 1000000000).
models[].digest
string
SHA-256 digest of the model name (for Ollama compatibility).

Example

curl http://localhost:11434/api/tags

Model Configuration

The available models are determined by:
  1. Environment Variables: API keys for providers (OpenAI, Google, OpenRouter)
  2. models.json: Custom model configuration file (optional)
  3. Built-in Models: Default models when no models.json exists

Built-in Models

If no models.json file exists, these built-in models are available:
  • OpenAI: gpt-4o-mini, gpt-4.1-mini, gpt-4.1-nano, gpt-4o
  • Google: gemini-2.5-flash, gemini-2.5-flash-lite
  • OpenRouter: deepseek-r1

Custom Model Configuration

Create a models.json file in your working directory to customize available models:
models.json
{
  "gpt-4o-mini": {
    "provider": "openai",
    "model": "gpt-4o-mini"
  },
  "claude-3-5-sonnet": {
    "provider": "openrouter",
    "model": "anthropic/claude-3.5-sonnet"
  },
  "custom-model-alias": {
    "provider": "openai",
    "model": "gpt-4-turbo"
  }
}
Only models whose providers have valid API keys configured via environment variables will be returned. If a provider’s API key is missing, its models will be filtered out.

Implementation Details

The endpoint implementation (from src/index.js:494-505):
'GET /api/tags': (request, response) => {
    const availableModels = Object.entries(models)
        .filter(([name, config]) => providers[config.provider])
        .map(([name]) => ({
            name,
            model: name,
            modified_at: new Date().toISOString(),
            size: 1000000000,
            digest: `sha256:${name.replace(/[^a-zA-Z0-9]/g, '')}`,
        }));
    sendJSON(response, { models: availableModels });
}

Build docs developers (and LLMs) love