모델 엔드포인트

모델 엔드포인트 (Models Endpoints)

모델 관리 API입니다. Mistral의 모델을 조회하고, 파인튜닝한 모델을 가져오고, 삭제하고, 이름이나 설명을 갱신하거나 보관/보관 해제하는 방법을 알려드릴게요.

출처: 문서

본문

모델 관리용 엔드포인트 모음이에요. 모델 목록을 확인하고, 개별 모델 정보를 조회하며, 파인튜닝 모델을 수정·삭제·보관하는 작업을 다룹니다.

GET /v1/models — List Models (모델 목록 조회)

사용자에게 제공되는 모든 모델을 나열합니다.

응답 필드:

  • provider#string|null — 모델 제공자 (프로바이더)
  • model#string|null — 모델 식별자
  • data#array<BaseModelCard|FTModelCard> — 모델 카드 목록
  • object#string — 기본값 "list"

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.models.list();

  console.log(result);
}

run();

Python:

from mistralai.client import Mistral
import os

with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.list()

    # Handle response
    print(res)

curl:

curl https://api.mistral.ai/v1/models \
 -X GET \
 -H 'Authorization: Bearer ***'

응답 예시 (200):

[
  {
    "id": "<model_id>",
    "capabilities": {
      "completion_chat": true,
      "completion_fim": false,
      "function_calling": false,
      "fine_tuning": false,
      "vision": false,
      "classification": false
    },
    "job": "<job_id>",
    "root": "open-mistral-7b",
    "object": "model",
    "created": 1756746619,
    "owned_by": "<owner_id>",
    "max_context_length": 32768,
    "aliases": [],
    "TYPE": "fine-tuned",
    "archived": false
  }
]

GET /v1/models/{model_id} — Retrieve Model (모델 조회)

특정 모델에 대한 정보를 가져옵니다.

경로 파라미터:

  • model_id#string (필수) — 조회할 모델의 ID.

응답 타입: BaseModelCard|FTModelCard (성공 시 200)

  • BaseModelCard — {object} 기본 모델 카드
  • FTModelCard — {object} 파인튜닝 모델 카드

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.models.retrieve({
    modelId: "ft:open-mistral-7b:587a6b29:20240514:7e773925",
  });

  console.log(result);
}

run();

Python:

from mistralai.client import Mistral
import os

with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.retrieve(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

curl:

curl https://api.mistral.ai/v1/models/{model_id} \
 -X GET \
 -H 'Authorization: Bearer ***'

응답 예시 (200):

{
  "id": "<your_model_id>",
  "capabilities": {
    "completion_chat": true,
    "completion_fim": false,
    "function_calling": false,
    "fine_tuning": false,
    "vision": false,
    "classification": false
  },
  "job": "<job_id>",
  "root": "open-mistral-7b",
  "object": "model",
  "created": 1756746619,
  "owned_by": "<owner_id>",
  "max_context_length": 32768,
  "aliases": [],
  "TYPE": "fine-tuned",
  "archived": false
}

DELETE /v1/models/{model_id} — Delete Model (모델 삭제)

파인튜닝한 모델을 삭제합니다.

경로 파라미터:

  • model_id#string (필수) — 삭제할 모델의 ID.

응답 필드 (200 Successful Response):

  • deleted#boolean — 기본값 true. 삭제 상태 여부.
  • id#string (필수) — 삭제된 모델의 ID.
  • object#string — 기본값 "model". 삭제된 객체의 타입.

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.models.delete({
    modelId: "ft:open-mistral-7b:587a6b29:20240514:7e773925",
  });

  console.log(result);
}

run();

Python:

from mistralai.client import Mistral
import os

with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.delete(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

curl:

curl https://api.mistral.ai/v1/models/{model_id} \
 -X DELETE \
 -H 'Authorization: Bearer ***' \
 -H 'Content-Type: application/json'

응답 예시 (200):

{
  "id": "ft:open-mistral-7b:587a6b29:20240514:7e773925",
  "object": "model",
  "deleted": true
}

PATCH /v1/fine_tuning/models/{model_id} — Update Fine Tuned Model (파인튜닝 모델 갱신)

모델의 이름이나 설명을 수정합니다.

경로 파라미터:

  • model_id#string (필수) — 갱신할 모델의 ID.

요청 본문:

  • description#string|null — 새 설명
  • name#string|null — 새 이름

응답 타입 (200 OK): CompletionFineTunedModel|ClassifierFineTunedModel

  • CompletionFineTunedModel — {object}
  • ClassifierFineTunedModel — {object}

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.models.update({
    modelId: "ft:open-mistral-7b:587a6b29:20240514:7e773925",
    updateModelRequest: {},
  });

  console.log(result);
}

run();

Python:

from mistralai.client import Mistral
import os

with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.update(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

curl:

curl https://api.mistral.ai/v1/fine_tuning/models/{model_id} \
 -X PATCH \
 -H 'Authorization: Bearer ***' \
 -H 'Content-Type: application/json' \
 -d '{}'

응답 예시 (200):

{
  "archived": "false",
  "capabilities": {},
  "created": "1735689600",
  "id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "owned_by": "9c0ab39f-0cd0-46cd-bd30-8bf2d50be5ce",
  "root": "mistral-small-latest",
  "root_version": "v1",
  "workspace_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}

POST /v1/fine_tuning/models/{model_id}/archive — Archive Fine Tuned Model (파인튜닝 모델 보관)

파인튜닝한 모델을 보관(archive)합니다.

경로 파라미터:

  • model_id#string (필수) — 보관할 모델의 ID.

응답 필드 (200 OK):

  • archived#boolean — 기본값 true
  • id#string (필수)
  • object#string — 기본값 "model"

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.models.archive({
    modelId: "ft:open-mistral-7b:587a6b29:20240514:7e773925",
  });

  console.log(result);
}

run();

Python:

from mistralai.client import Mistral
import os

with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.archive(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

curl:

curl https://api.mistral.ai/v1/fine_tuning/models/{model_id}/archive \
 -X POST \
 -H 'Authorization: Bearer ***' \
 -H 'Content-Type: application/json'

응답 예시 (200):

{
  "id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}

DELETE /v1/fine_tuning/models/{model_id}/archive — Unarchive Fine Tuned Model (파인튜닝 모델 보관 해제)

보관한 파인튜닝 모델을 다시 보관 해제(unarchive)합니다.

경로 파라미터:

  • model_id#string (필수) — 보관 해제할 모델의 ID.

응답 필드 (200 OK):

  • archived#boolean — 기본값 false
  • id#string (필수)
  • object#string — 기본값 "model"

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.models.unarchive({
    modelId: "ft:open-mistral-7b:587a6b29:20240514:7e773925",
  });

  console.log(result);
}

run();

Python:

from mistralai.client import Mistral
import os

with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.models.unarchive(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")

    # Handle response
    print(res)

curl:

curl https://api.mistral.ai/v1/fine_tuning/models/{model_id}/archive \
 -X DELETE \
 -H 'Authorization: Bearer ***' \
 -H 'Content-Type: application/json'

응답 예시 (200):

{
  "id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}

더 알아보기 (Learn more)