---
title: "Create a new model"
method: POST
path: "/v1/models"
tags: ["Models"]
---

# Create a new model

`POST /v1/models`

## Request

- Base URL: `https://api.lunary.ai`
- URL: `https://api.lunary.ai/v1/models`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/lunary/apis/lunary-api/docs/v1/models/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- ModelInput
  - `name` string, required
  - `pattern` string, required
  - `unit` 'TOKENS' | 'CHARACTERS' | 'MILLISECONDS', required
  - `inputCost` number, required
  - `outputCost` number, required
  - `tokenizer` string
  - `startDate` string, date-time

## Response `200`

Successful response

- Model
  - `id` string
  - `name` string
  - `pattern` string
  - `unit` 'TOKENS' | 'CHARACTERS' | 'MILLISECONDS'
  - `inputCost` number
  - `outputCost` number
  - `tokenizer` string
  - `startDate` string, date-time
  - `createdAt` string, date-time
  - `updatedAt` string, date-time

---

[API](https://skmtc.dev/lunary/apis/lunary-api.md) - [All operations](https://skmtc.dev/lunary/apis/lunary-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lunary/apis/lunary-api/revisions/a38233713bdc?raw)
