# default_model Settings in Lemon AI: Configuration Options and API Reference

> Explore default_model settings in Lemon AI. Learn about configurable fields like id, setting_type, model_id, config, and timing to control LLM functions for chat, naming, and translation.

- Repository: [hexdocom/lemonai](https://github.com/hexdocom/lemonai)
- Tags: api-reference
- Published: 2026-03-03

---

**The default_model settings in Lemon AI expose five configurable fields—`id`, `setting_type`, `model_id`, `config`, `create_at`, and `update_at`—that control which LLM powers specific system functions like chat assistance, topic naming, and translation.**

Lemon AI manages its default AI providers through the structured `default_model_setting` configuration layer exposed via the `/api/default_model_setting` REST API. These settings determine which large language model (LLM) handles distinct tasks across the platform, from general chat to specialized translation services. The configuration schema is defined in [`public/schemas/default_model_setting.json`](https://github.com/hexdocom/lemonai/blob/main/public/schemas/default_model_setting.json) and enforced by the **DefaultModelSetting** Sequelize model.

## Core Configuration Fields

The `default_model_setting` table stores five distinct fields that define how the system routes requests to underlying models. Each record maps a functional category to a specific model configuration.

- **id**: Integer primary key that uniquely identifies the setting record in the database.

- **setting_type**: String categorization that determines which system function consumes the default model. Valid values are defined in the schema as:
  - `assistant`: The LLM used for normal chat interactions.
  - `topic_naming`: The model dedicated to generating conversation topic names.
  - `translation`: The model handling translation tasks.

- **model_id**: String containing the UUID or ID of the **Model** record that should serve as the default for the specified `setting_type`. This creates a foreign key relationship to the models table.

- **config**: JSON object storing arbitrary model-specific parameters. According to the source schema, this object accepts provider-specific overrides such as `temperature`, `max_tokens`, or custom system prompts. The exact structure depends on the underlying model provider implementation.

- **create_at**: ISO 8601 datetime string indicating when the setting record was first persisted.

- **update_at**: ISO 8601 datetime string tracking the last modification timestamp.

## Managing Settings via the REST API

The backend exposes the `default_model_setting` configuration through the `/api/default_model_setting` endpoint implemented in [`src/routers/default_model_setting/default_model_setting.js`](https://github.com/hexdocom/lemonai/blob/main/src/routers/default_model_setting/default_model_setting.js). This router handles validation, persistence, and retrieval operations against the `DefaultModelSetting` Sequelize model defined in [`src/models/DefaultModelSetting.js`](https://github.com/hexdocom/lemonai/blob/main/src/models/DefaultModelSetting.js).

### Updating Default Model Configuration

To modify which model handles a specific function, send a PUT request to `/api/default_model_setting` with a payload containing the `setting_type`, `model_id`, and optional `config` parameters.

```javascript
// Payload structure for PUT /api/default_model_setting
{
  "setting_type": "assistant",
  "model_id": "42",
  "config": {
    "temperature": 0.7,
    "max_tokens": 1500,
    "custom_prompt": "You are a helpful AI assistant."
  }
}

```

The frontend service wraps this operation in [`frontend/src/services/default-model-setting.js`](https://github.com/hexdocom/lemonai/blob/main/frontend/src/services/default-model-setting.js):

```javascript
import request from '@/utils/request'

export const updateDefaultModelSetting = (payload) => {
  return request.put('/api/default_model_setting', payload)
}

```

### Retrieving Current Settings

Fetch all active default model mappings using the GET endpoint. The response returns an array of configuration objects including the timestamp fields.

```javascript
// Frontend service method in frontend/src/services/default-model-setting.js
export const getDefaultModelSettings = () => {
  return request.get('/api/default_model_setting')
}

// Example response structure
[
  {
    "id": 3,
    "setting_type": "assistant",
    "model_id": "42",
    "config": { "temperature": 0.7, "max_tokens": 1500 },
    "create_at": "2024-09-18T12:34:56.000Z",
    "update_at": "2024-09-20T08:12:30.000Z"
  }
]

```

## Server-Side Validation and Persistence

The router implementation validates incoming requests against the JSON schema before persisting to the database. In [`src/routers/default_model_setting/default_model_setting.js`](https://github.com/hexdocom/lemonai/blob/main/src/routers/default_model_setting/default_model_setting.js), the request body is destructured to extract the core fields:

```javascript
router.put("/", async ({ state, request, response }) => {
  const { setting_type, model_id, config } = request.body || {}
  // Fields are validated and persisted via the DefaultModelSetting Sequelize model
  // ...
})

```

The `DefaultModelSetting` model maps these fields to the `default_model_setting` table columns, ensuring type safety and referential integrity with the underlying `Model` table referenced by `model_id`.

## Summary

- The `default_model_setting` table contains five fields: `id`, `setting_type`, `model_id`, `config`, `create_at`, and `update_at`.
- Three functional categories exist: `assistant`, `topic_naming`, and `translation`, each routing to a distinct model via `model_id`.
- The `config` JSON field accepts provider-specific parameters like temperature and max tokens without strict schema enforcement on the object structure.
- All operations route through `/api/default_model_setting` with validation performed against [`public/schemas/default_model_setting.json`](https://github.com/hexdocom/lemonai/blob/main/public/schemas/default_model_setting.json).
- Frontend integration uses the service methods in [`frontend/src/services/default-model-setting.js`](https://github.com/hexdocom/lemonai/blob/main/frontend/src/services/default-model-setting.js) to abstract HTTP calls.

## Frequently Asked Questions

### What are the valid values for setting_type in Lemon AI?

The `setting_type` field accepts three string values defined in the schema: `assistant` for general chat LLMs, `topic_naming` for models that generate conversation titles, and `translation` for models handling language translation tasks. Each value routes requests to the model specified in the corresponding `model_id` field.

### How does the config field structure work in default_model_setting?

The `config` field is a flexible JSON object that stores model-specific runtime parameters. According to the source code analysis, you can include properties like `temperature`, `max_tokens`, or custom prompts. The exact structure depends on the underlying model provider implementation, allowing per-model customization without schema migrations.

### Which API endpoint manages default model configuration in Lemon AI?

The system exposes configuration management through `/api/default_model_setting`. This endpoint supports PUT requests to update settings and GET requests to retrieve the current configuration array. The router implementation in [`src/routers/default_model_setting/default_model_setting.js`](https://github.com/hexdocom/lemonai/blob/main/src/routers/default_model_setting/default_model_setting.js) handles request validation and database persistence via the Sequelize model.

### Where is the default model schema defined in the source code?

The JSON schema defining valid fields and types resides in [`public/schemas/default_model_setting.json`](https://github.com/hexdocom/lemonai/blob/main/public/schemas/default_model_setting.json). This schema drives the validation logic in the API router and documents the expected shape of `setting_type`, `model_id`, and `config` fields for the `DefaultModelSetting` Sequelize model.