---
title: "Export to Hugging Face"
method: POST
path: "/api/v3/models/{model_id}/export-hf"
tags: ["Models"]
---

# Export to Hugging Face

`POST /api/v3/models/{model_id}/export-hf`

## Request

- Base URL: `https://api.nugen.in`
- URL: `https://api.nugen.in/api/v3/models/{model_id}/export-hf`
- Auth: HTTP bearer

Export the aligned model's weights to the given Hugging Face repository.

**Path Parameters:**

- `model_id`: Unique identifier of the aligned model

**Request Body:**

- `hf_repo` (optional): Target repository, e.g. `org/model-name`. Defaults to the
  token's own namespace plus the model id.
- `visibility`: `private` or `public`
- `token`: Hugging Face access token

Runs in the background. Poll `GET /models/{model_id}/export-hf/status`
for progress. Export is open for base models within the supported size
range. Other sizes need an Enterprise licence and answer with status
`FAILED` and a message.

## Path parameters

- `model_id` string, required

## Request body

- ModelExportHfRequest: Export an aligned model to a Hugging Face repository.
  - `hf_repo` string, nullable: Target repository, e.g. org/model-name. Defaults to the token's own namespace plus the model id.
  - `visibility` 'private' | 'public': private or public
  - `token` string, required: Hugging Face access token. Used only to perform the export; never logged or stored.

## Response `200`

Acknowledges the export request for the aligned model.

- ModelExportHfResponse: Acknowledgement of a Hugging Face export request.
  - `export_id` string, required: Identifier of the export request. Poll status with it.
  - `model_id` string, required: Aligned model the export was requested for.
  - `status` 'QUEUED' | 'PROCESSING' | 'READY' | 'FAILED' | 'STOPPED', required: Lifecycle status of a resource that runs asynchronously. Stored as is and returned as is, with no translation in between. - `QUEUED`: accepted and waiting for its workflow to start - `PROCESSING`: running - `READY`: finished successfully - `FAILED`: failed at any stage - `STOPPED`: stopped by the user before completion
  - `message` string, nullable: Why the export was refused, when the status is FAILED.

## Other responses

- `401`: Invalid API key
- `403`: Authorization header missing or not a Bearer token
- `404`: Resource not found
- `422`: Validation Error

---

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