Ресурс

LLM Provider

Manage LLM Provider configurations. Connect to OpenAI, Anthropic, Ollama, or other LLM providers to enable AI features.

Модель LLM Provider

Свойства

  • Имя
    _id
    Тип
    Object ID
    Описание

    ID of this object

  • Имя
    createdAt
    Тип
    Date
    Описание

    Date and Time when the object was created.

  • Имя
    updatedAt
    Тип
    Date
    Описание

    Date and Time when the object was updated.

  • Имя
    name
    Тип
    NameОбязательно
    Описание

    A friendly name for this LLM configuration.

  • Имя
    description
    Тип
    Long Text
    Описание

    Description of this LLM configuration.

  • Имя
    slug
    Тип
    SlugОбязательно
    Описание

    Friendly globally unique name for your object

  • Имя
    llmType
    Тип
    TextОбязательно
    Описание

    The type of LLM provider (OpenAI, Anthropic, Ollama, etc.)

  • Имя
    apiKey
    Тип
    Long Text
    Описание

    The API key for the LLM provider. Required for OpenAI and Anthropic.

  • Имя
    modelName
    Тип
    Text
    Описание

    The name of the model to use (e.g., gpt-4, claude-3-opus, llama2).

  • Имя
    baseUrl
    Тип
    Short URL
    Описание

    The base URL for the LLM API. Required for Ollama, optional for others.

  • Имя
    project
    Тип
    Project
    Описание

    The project this LLM belongs to. If null, it is a global LLM.

  • Имя
    projectId
    Тип
    Object ID
    Описание

    ID of the project this LLM belongs to. If null, it is a global LLM.

  • Имя
    createdByUser
    Тип
    User
    Описание

  • Имя
    createdByUserId
    Тип
    Object ID
    Описание

    User ID who created this object (if this object was created by a User)

  • Имя
    isDefault
    Тип
    BooleanОбязательно
    Описание

    Is this the default LLM provider for the project? When set, the global LLM provider will not be used.

  • Имя
    costPerMillionTokensInUSDCents
    Тип
    NumberОбязательно
    Описание

    Cost per million tokens in USD cents. Used for billing when using global LLM providers.

GETorPOST/api/llm-provider/get-list

Список

Этот метод возвращает постраничный список ваших объектов «LLM Provider». По умолчанию на странице до десяти записей.

Необязательные query-параметры

  • limit
    число
    Сколько объектов вернуть. По умолчанию 10, максимум 100
  • skip
    число
    Сколько объектов пропустить (для пагинации)

Необязательное тело запроса

Запрос списка

POST
/api/llm-provider/get-list?skip=0&limit=10
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "select": {
    "costPerMillionTokensInUSDCents": true,
    "isDefault": true,
    "llmType": true,
    "name": true,
    "slug": true
  },
  "query": {
    "llmType": "Example llm type"
  },
  "sort": {
    "createdAt": -1
  }
}

Ответ

{
  "count": 10,
  "limit": 10,
  "skip": 0,
  "data": [
    {
      "_id": "377402b0-28fe-11f1-b591-3fdcef396aba",
      "costPerMillionTokensInUSDCents": 100,
      "isDefault": true,
      "llmType": "Example llm type",
      "name": "Example name",
      "slug": "Example slug"
    },
    {
      "_id": "377402b1-28fe-11f1-b591-3fdcef396aba",
      "costPerMillionTokensInUSDCents": 100,
      "isDefault": true,
      "llmType": "Example llm type",
      "name": "Example name",
      "slug": "Example slug"
    },
    {
      "_id": "377402b2-28fe-11f1-b591-3fdcef396aba",
      "costPerMillionTokensInUSDCents": 100,
      "isDefault": true,
      "llmType": "Example llm type",
      "name": "Example name",
      "slug": "Example slug"
    }
  ]
}
GETorPOST/api/llm-provider/:id/get-item

Получить по ID

Возвращает объект «LLM Provider» по идентификатору.

  • id
    строка
    ID объекта

Необязательное тело запроса

  • select
    По умолчанию возвращается только ID; для других полей используйте select. Подробнее: как выбирать поля.

Запрос одного объекта

POST
/api/llm-provider/:id/get-item
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "select": {
    "costPerMillionTokensInUSDCents": true,
    "isDefault": true,
    "llmType": true,
    "name": true,
    "slug": true
  }
}

Ответ

{
  "_id": "377402b0-28fe-11f1-b591-3fdcef396aba",
  "costPerMillionTokensInUSDCents": 100,
  "isDefault": true,
  "llmType": "Example llm type",
  "name": "Example name",
  "slug": "Example slug"
}
POST/api/llm-provider/count

Количество

Возвращает количество ваших объектов «LLM Provider».

Необязательное тело запроса

Запрос количества

POST
/api/llm-provider/count
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "query": {
    "llmType": "Example llm type"
  }
}

Ответ

{
  "count": 107
}
POST/api/llm-provider

Создать LLM Provider

Создаёт новый объект.

Запрос создания

POST
/api/llm-provider
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "data": {
    "isDefault": true,
    "llmType": "Example llm type",
    "name": "Example name",
    "apiKey": "Example api key",
    "baseUrl": "https://example.com"
  }
}

Ответ

{
  "_id": "377402b0-28fe-11f1-b591-3fdcef396aba",
  "costPerMillionTokensInUSDCents": 100,
  "isDefault": true,
  "llmType": "Example llm type",
  "name": "Example name",
  "slug": "Example slug"
}
PUT/api/llm-provider/:id

Обновить по ID

Обновляет объект по ID.

Альтернативные методы

Если клиент не поддерживает PUT, используйте POST или GET с теми же заголовками и телом:

POST/api/llm-provider/:id/update-item
GET/api/llm-provider/:id/update-item

Запрос обновления

PUT
/api/llm-provider/:id
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "data": {
    "isDefault": true,
    "llmType": "Example llm type",
    "name": "Example name"
  }
}

Ответ

{}
DELETE/api/llm-provider/:id

Удалить по ID

Удаляет объект по ID.

Альтернативные методы

Если клиент не поддерживает DELETE, используйте POST или GET с теми же заголовками и телом:

POST/api/llm-provider/:id/delete-item
GET/api/llm-provider/:id/delete-item

Запрос удаления

DELETE
/api/llm-provider/:id
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY

Ответ

{}

Права доступа

Для операций с ресурсом у ключа API должны быть права. При их отсутствии вернётся ответ 4xx.

Права на чтение

Нужны для чтения LLM Provider

  • Public
  • Project Owner
  • Project Admin
  • Project Member
  • Read LLM
  • Read All Project Resources

Права на создание

Нужны для создания LLM Provider

  • Project Owner
  • Project Admin
  • Project Member
  • Create LLM

Права на обновление

Нужны для обновления LLM Provider

  • Project Owner
  • Project Admin
  • Project Member
  • Edit LLM

Права на удаление

Нужны для удаления LLM Provider

  • Project Owner
  • Project Admin
  • Project Member
  • Delete LLM