# Lists fine-tuned models.

GET https://api.cohere.com/v1/finetuning/finetuned-models

Returns a list of fine-tuned models that the user has access to.

Reference: https://docs.cohere.com/reference/listfinetunedmodels

## OpenAPI Specification

```yaml
openapi: 3.1.1
info:
  title: Lists fine-tuned models.
  version: endpoint_finetuning.ListFinetunedModels
paths:
  /v1/finetuning/finetuned-models:
    get:
      operationId: list-finetuned-models
      summary: Lists fine-tuned models.
      description: Returns a list of fine-tuned models that the user has access to.
      tags:
        - - subpackage_finetuning
      parameters:
        - name: page_size
          in: query
          description: >-
            Maximum number of results to be returned by the server. If 0,
            defaults to

            50.
          required: false
          schema:
            type: integer
        - name: page_token
          in: query
          description: Request a specific page of the list results.
          required: false
          schema:
            type: string
        - name: order_by
          in: query
          description: >-
            Comma separated list of fields. For example: "created_at,name". The
            default

            sorting order is ascending. To specify descending order for a field,
            append

            " desc" to the field name. For example: "created_at desc,name".


            Supported sorting fields:
              - created_at (default)
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: >-
            Bearer authentication of the form `Bearer <token>`, where token is
            your auth token.
          required: true
          schema:
            type: string
        - name: X-Client-Name
          in: header
          description: |
            The name of the project that is making the request.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListFinetunedModelsResponse'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '503':
          description: Status Service Unavailable
          content: {}
components:
  schemas:
    BaseType:
      type: string
      enum:
        - value: BASE_TYPE_UNSPECIFIED
        - value: BASE_TYPE_GENERATIVE
        - value: BASE_TYPE_CLASSIFICATION
        - value: BASE_TYPE_RERANK
        - value: BASE_TYPE_CHAT
      default: BASE_TYPE_UNSPECIFIED
    Strategy:
      type: string
      enum:
        - value: STRATEGY_UNSPECIFIED
        - value: STRATEGY_VANILLA
        - value: STRATEGY_TFEW
      default: STRATEGY_UNSPECIFIED
    BaseModel:
      type: object
      properties:
        name:
          type: string
          description: The name of the base model.
        version:
          type: string
          description: read-only. The version of the base model.
        base_type:
          $ref: '#/components/schemas/BaseType'
          description: The type of the base model.
        strategy:
          $ref: '#/components/schemas/Strategy'
          description: 'Deprecated: The fine-tuning strategy.'
      required:
        - base_type
    LoraTargetModules:
      type: string
      enum:
        - value: LORA_TARGET_MODULES_UNSPECIFIED
        - value: LORA_TARGET_MODULES_QV
        - value: LORA_TARGET_MODULES_QKVO
        - value: LORA_TARGET_MODULES_QKVO_FFN
      default: LORA_TARGET_MODULES_UNSPECIFIED
    Hyperparameters:
      type: object
      properties:
        early_stopping_patience:
          type: integer
          description: >-
            Stops training if the loss metric does not improve beyond the value
            of

            `early_stopping_threshold` after this many times of evaluation.
        early_stopping_threshold:
          type: number
          format: double
          description: How much the loss must improve to prevent early stopping.
        train_batch_size:
          type: integer
          description: >-
            The batch size is the number of training examples included in a
            single

            training pass.
        train_epochs:
          type: integer
          description: The number of epochs to train for.
        learning_rate:
          type: number
          format: double
          description: The learning rate to be used during training.
        lora_alpha:
          type: integer
          description: |-
            Controls the scaling factor for LoRA updates. Higher values make the
            updates more impactful.
        lora_rank:
          type: integer
          description: >-
            Specifies the rank for low-rank matrices. Lower ranks reduce
            parameters

            but may limit model flexibility.
        lora_target_modules:
          $ref: '#/components/schemas/LoraTargetModules'
          description: The combination of LoRA modules to target.
    WandbConfig:
      type: object
      properties:
        project:
          type: string
          description: The WandB project name to be used during training.
        api_key:
          type: string
          description: The WandB API key to be used during training.
        entity:
          type: string
          description: The WandB entity name to be used during training.
      required:
        - project
        - api_key
    Settings:
      type: object
      properties:
        base_model:
          $ref: '#/components/schemas/BaseModel'
          description: The base model to fine-tune.
        dataset_id:
          type: string
          description: The data used for training and evaluating the fine-tuned model.
        hyperparameters:
          $ref: '#/components/schemas/Hyperparameters'
          description: Fine-tuning hyper-parameters.
        multi_label:
          type: boolean
          description: >-
            read-only. Whether the model is single-label or multi-label (only
            for classification).
        wandb:
          $ref: '#/components/schemas/WandbConfig'
          description: The Weights & Biases configuration (Chat fine-tuning only).
      required:
        - base_model
        - dataset_id
    Status:
      type: string
      enum:
        - value: STATUS_UNSPECIFIED
        - value: STATUS_FINETUNING
        - value: STATUS_DEPLOYING_API
        - value: STATUS_READY
        - value: STATUS_FAILED
        - value: STATUS_DELETED
        - value: STATUS_TEMPORARILY_OFFLINE
        - value: STATUS_PAUSED
        - value: STATUS_QUEUED
      default: STATUS_UNSPECIFIED
    FinetunedModel:
      type: object
      properties:
        id:
          type: string
          description: read-only. FinetunedModel ID.
        name:
          type: string
          description: FinetunedModel name (e.g. `foobar`).
        creator_id:
          type: string
          description: read-only. User ID of the creator.
        organization_id:
          type: string
          description: read-only. Organization ID.
        settings:
          $ref: '#/components/schemas/Settings'
          description: FinetunedModel settings such as dataset, hyperparameters...
        status:
          $ref: '#/components/schemas/Status'
          description: read-only. Current stage in the life-cycle of the fine-tuned model.
        created_at:
          type: string
          format: date-time
          description: read-only. Creation timestamp.
        updated_at:
          type: string
          format: date-time
          description: read-only. Latest update timestamp.
        completed_at:
          type: string
          format: date-time
          description: read-only. Timestamp for the completed fine-tuning.
        last_used:
          type: string
          format: date-time
          description: >-
            read-only. Deprecated: Timestamp for the latest request to this
            fine-tuned model.
      required:
        - name
        - settings
    ListFinetunedModelsResponse:
      type: object
      properties:
        finetuned_models:
          type: array
          items:
            $ref: '#/components/schemas/FinetunedModel'
          description: List of fine-tuned models matching the request.
        next_page_token:
          type: string
          description: >-
            Pagination token to retrieve the next page of results. If the value
            is "",

            it means no further results for the request.
        total_size:
          type: integer
          description: Total count of results.

```

## SDK Code Examples

```java Cohere java SDK
/* (C)2024 */
package finetuning;

import com.cohere.api.Cohere;
import com.cohere.api.resources.finetuning.finetuning.types.ListFinetunedModelsResponse;

public class ListFinetunedModels {
  public static void main(String[] args) {
    Cohere cohere = Cohere.builder().clientName("snippet").build();

    ListFinetunedModelsResponse response = cohere.finetuning().listFinetunedModels();

    System.out.println(response);
  }
}

```

```go Cohere Go SDK
package main

import (
	"context"
	"log"
	"os"

	"github.com/cohere-ai/cohere-go/v2/client"
)

func main() {
	co := client.NewClient(client.WithToken(os.Getenv("CO_API_KEY")))

	resp, err := co.Finetuning.ListFinetunedModels(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%+v", resp.FinetunedModels)
}

```

```typescript Cohere TypeScript SDK
const { CohereClient } = require('cohere-ai');

const cohere = new CohereClient({
  token: '<<apiKey>>',
});

(async () => {
  const finetunedModels = await cohere.finetuning.listFinetunedModels();

  console.log(finetunedModels);
})();

```

```python Sync
import cohere

co = cohere.Client()
response = co.finetuning.list_finetuned_models()
print(response)

```

```python Async
import cohere
import asyncio

co = cohere.AsyncClient()


async def main():
    response = await co.finetuning.list_finetuned_models()
    print(response)


asyncio.run(main())

```

```ruby /finetuning_ListFinetunedModels_example
require 'uri'
require 'net/http'

url = URI("https://api.cohere.com/v1/finetuning/finetuned-models")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Client-Name"] = 'my-cool-project'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```php /finetuning_ListFinetunedModels_example
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.cohere.com/v1/finetuning/finetuned-models', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Client-Name' => 'my-cool-project',
  ],
]);

echo $response->getBody();
```

```csharp /finetuning_ListFinetunedModels_example
var client = new RestClient("https://api.cohere.com/v1/finetuning/finetuned-models");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Client-Name", "my-cool-project");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift /finetuning_ListFinetunedModels_example
import Foundation

let headers = [
  "X-Client-Name": "my-cool-project",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cohere.com/v1/finetuning/finetuned-models")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```