> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

> Returns models grouped by provider. Optional `provider` query filters to one provider.

Session-authenticated APIs used by the Manage Models UI for the active database configuration.

## Operations

| Method | Path | Purpose |
| - | - | - |
| `GET` | `/api/openground/models` | List models (optional `?provider=`) |
| `POST` | `/api/openground/models` | Create or update a model |
| `DELETE` | `/api/openground/models?model_id=&provider=` | Delete a model |

## Examples

> [tab] List
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X GET "/api/openground/models" \
>   -H "Cookie: <signed-in-session-cookie>"
> ```

> [tab] Create or update
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X POST "/api/openground/models" \
>   -H "Content-Type: application/json" \
>   -H "Cookie: <signed-in-session-cookie>" \
>   -d '{
>     "provider": "openai",
>     "model": {
>       "id": "gpt-4o-custom",
>       "model_id": "gpt-4o-custom",
>       "displayName": "GPT-4o Custom",
>       "modelType": "chat",
>       "contextWindow": 128000,
>       "inputPricePerMToken": 2.5,
>       "outputPricePerMToken": 10,
>       "capabilities": ["function-calling"]
>     }
>   }'
> ```

> [tab] Delete
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl -X DELETE "/api/openground/models?model_id=gpt-4o-custom&provider=openai" \
>   -H "Cookie: <signed-in-session-cookie>"
> ```

> [!NOTE]
>
> These routes require a signed-in OpenLIT browser session. They are not the same as API-key authenticated SDK endpoints such as Prompt Hub or Vault.


## OpenAPI

````yaml GET /api/openground/models
openapi: 3.0.0
info:
  title: Manage Models - Models API
  description: >-
    List, create or update, and delete LLM models and pricing for the active
    database configuration. Requires a signed-in OpenLIT session (same APIs the
    Manage Models UI calls).
  version: 1.0.0
servers:
  - url: /
security:
  - sessionAuth: []
paths:
  /api/openground/models:
    get:
      summary: List models
      description: >-
        Returns models grouped by provider. Optional `provider` query filters to
        one provider.
      operationId: listModels
      parameters:
        - name: provider
          in: query
          required: false
          schema:
            type: string
          example: openai
      responses:
        '200':
          description: Models grouped by provider id, or a list when `provider` is set.
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: object
                    properties:
                      model_id:
                        type: string
                      displayName:
                        type: string
                      modelType:
                        type: string
                      contextWindow:
                        type: number
                      inputPricePerMToken:
                        type: number
                      outputPricePerMToken:
                        type: number
                      capabilities:
                        type: array
                        items:
                          type: string
                      isDefault:
                        type: boolean
        '401':
          description: Not signed in
components:
  securitySchemes:
    sessionAuth:
      type: apiKey
      in: cookie
      name: next-auth.session-token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.