# Finetunes ## List Finetunes `client.ai.finetunes.list(FinetuneListParamsparams, RequestOptionsoptions?): FinetuneListResponse` **get** `/accounts/{account_id}/ai/finetunes` Lists all fine-tuning jobs created by the account, including status and metrics. ### Parameters - `params: FinetuneListParams` - `account_id: string` ### Returns - `FinetuneListResponse` - `id: string` - `created_at: string` - `model: string` - `modified_at: string` - `name: string` - `description?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const finetunes = await client.ai.finetunes.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(finetunes.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "model": "model", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "description": "description" }, "success": true } ``` ## Create a new Finetune `client.ai.finetunes.create(FinetuneCreateParamsparams, RequestOptionsoptions?): FinetuneCreateResponse` **post** `/accounts/{account_id}/ai/finetunes` Creates a new fine-tuning job for a Workers AI model using custom training data. ### Parameters - `params: FinetuneCreateParams` - `account_id: string` Path param - `model: string` Body param - `name: string` Body param - `description?: string` Body param - `_public?: boolean` Body param ### Returns - `FinetuneCreateResponse` - `id: string` - `created_at: string` - `model: string` - `modified_at: string` - `name: string` - `public: boolean` - `description?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const finetune = await client.ai.finetunes.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', model: 'model', name: 'name', }); console.log(finetune.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "model": "model", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "public": true, "description": "description" }, "success": true } ``` ## Domain Types ### Finetune List Response - `FinetuneListResponse` - `id: string` - `created_at: string` - `model: string` - `modified_at: string` - `name: string` - `description?: string` ### Finetune Create Response - `FinetuneCreateResponse` - `id: string` - `created_at: string` - `model: string` - `modified_at: string` - `name: string` - `public: boolean` - `description?: string` # Assets ## Upload a Finetune Asset `client.ai.finetunes.assets.create(stringfinetuneId, AssetCreateParamsparams, RequestOptionsoptions?): AssetCreateResponse` **post** `/accounts/{account_id}/ai/finetunes/{finetune_id}/finetune-assets` Uploads training data assets for a Workers AI fine-tuning job. ### Parameters - `finetuneId: string` - `params: AssetCreateParams` - `account_id: string` Path param - `file?: Uploadable` Body param - `file_name?: string` Body param ### Returns - `AssetCreateResponse` - `success: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const asset = await client.ai.finetunes.assets.create('bc451aef-f723-4b26-a6b2-901afd2e7a8a', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(asset.success); ``` #### Response ```json { "success": true } ``` ## Domain Types ### Asset Create Response - `AssetCreateResponse` - `success: boolean` # Public ## List Public Finetunes `client.ai.finetunes.public.list(PublicListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/ai/finetunes/public` Lists publicly available fine-tuned models that can be used with Workers AI. ### Parameters - `params: PublicListParams` - `account_id: string` Path param - `limit?: number` Query param: Pagination Limit - `offset?: number` Query param: Pagination Offset - `orderBy?: string` Query param: Order By Column Name ### Returns - `PublicListResponse` - `id: string` - `created_at: string` - `model: string` - `modified_at: string` - `name: string` - `public: boolean` - `description?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const publicListResponse of client.ai.finetunes.public.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(publicListResponse.id); } ``` #### Response ```json { "result": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "created_at": "2019-12-27T18:11:19.117Z", "model": "model", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "public": true, "description": "description" } ], "success": true } ``` ## Domain Types ### Public List Response - `PublicListResponse` - `id: string` - `created_at: string` - `model: string` - `modified_at: string` - `name: string` - `public: boolean` - `description?: string`