Portkey Fine-tuning API

Manage fine-tuning jobs to tailor a model to your specific training data.

OpenAPI Specification

portkey-fine-tuning-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Portkey Analytics > Graphs Fine-tuning API
  description: The Portkey REST API. Please see https://portkey.ai/docs/api-reference for more details.
  version: 2.0.0
  termsOfService: https://portkey.ai/terms
  contact:
    name: Portkey Developer Forum
    url: https://portkey.wiki/community
  license:
    name: MIT
    url: https://github.com/Portkey-AI/portkey-openapi/blob/master/LICENSE
servers:
- url: https://api.portkey.ai/v1
  description: Portkey API Public Endpoint
security:
- Portkey-Key: []
tags:
- name: Fine-tuning
  description: Manage fine-tuning jobs to tailor a model to your specific training data.
paths:
  /fine_tuning/jobs:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_GATEWAY_URL
      description: Self-Hosted Gateway URL
    get:
      operationId: listPaginatedFineTuningJobs
      tags:
      - Fine-tuning
      summary: 'List your organization''s fine-tuning jobs

        '
      parameters:
      - name: after
        in: query
        description: Identifier for the last job from the previous pagination request.
        required: false
        schema:
          type: string
      - name: limit
        in: query
        description: Number of fine-tuning jobs to retrieve.
        required: false
        schema:
          type: integer
          default: 20
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPaginatedFineTuningJobsResponse'
      security:
      - Portkey-Key: []
        Virtual-Key: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
      - Portkey-Key: []
        Config: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
        Custom-Host: []
      x-code-samples:
      - lang: curl
        label: Default
        source: "curl https://api.portkey.ai/v1/fine_tuning/jobs?limit=2 \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.list()\n"
      - lang: javascript
        label: Default
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const list = await client.fineTuning.jobs.list();\n\n  for await (const fineTune of list) {\n    console.log(fineTune);\n  }\n}\n\nmain();\n"
      - lang: curl
        label: Self-hosted
        source: "curl https://SELF_HOSTED_GATEWAY_URL/fine_tuning/jobs?limit=2 \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Self-hosted
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  base_url = \"SELF_HOSTED_GATEWAY_URL\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.list()\n"
      - lang: javascript
        label: Self-hosted
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  baseUrl: 'SELF_HOSTED_GATEWAY_URL',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const list = await client.fineTuning.jobs.list();\n\n  for await (const fineTune of list) {\n    console.log(fineTune);\n  }\n}\n\nmain();\n"
  /fine_tuning/jobs/{fine_tuning_job_id}:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_GATEWAY_URL
      description: Self-Hosted Gateway URL
    get:
      operationId: retrieveFineTuningJob
      tags:
      - Fine-tuning
      summary: 'Get info about a fine-tuning job.


        [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)

        '
      parameters:
      - in: path
        name: fine_tuning_job_id
        required: true
        schema:
          type: string
          example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
        description: 'The ID of the fine-tuning job.

          '
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FineTuningJob'
      security:
      - Portkey-Key: []
        Virtual-Key: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
      - Portkey-Key: []
        Config: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
        Custom-Host: []
      x-code-samples:
      - lang: curl
        label: Default
        source: "curl https://api.portkey.ai/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.retrieve(\"ftjob-abc123\")\n"
      - lang: javascript
        label: Default
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const fineTune = await client.fineTuning.jobs.retrieve(\"ftjob-abc123\");\n\n  console.log(fineTune);\n}\n\nmain();\n"
      - lang: curl
        label: Self-hosted
        source: "curl SELF_HOSTED_GATEWAY_URL/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Self-hosted
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  base_url = \"SELF_HOSTED_GATEWAY_URL\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.retrieve(\"ftjob-abc123\")\n"
      - lang: javascript
        label: Self-hosted
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  baseUrl: 'SELF_HOSTED_GATEWAY_URL',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const fineTune = await client.fineTuning.jobs.retrieve(\"ftjob-abc123\");\n\n  console.log(fineTune);\n}\n\nmain();\n"
  /fine_tuning/jobs/{fine_tuning_job_id}/events:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_GATEWAY_URL
      description: Self-Hosted Gateway URL
    get:
      operationId: listFineTuningEvents
      tags:
      - Fine-tuning
      summary: 'Get status updates for a fine-tuning job.

        '
      parameters:
      - in: path
        name: fine_tuning_job_id
        required: true
        schema:
          type: string
          example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
        description: 'The ID of the fine-tuning job to get events for.

          '
      - name: after
        in: query
        description: Identifier for the last event from the previous pagination request.
        required: false
        schema:
          type: string
      - name: limit
        in: query
        description: Number of events to retrieve.
        required: false
        schema:
          type: integer
          default: 20
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListFineTuningJobEventsResponse'
      security:
      - Portkey-Key: []
        Virtual-Key: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
      - Portkey-Key: []
        Config: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
        Custom-Host: []
      x-code-samples:
      - lang: curl
        label: Default
        source: "curl https://api.portkey.ai/v1/fine_tuning/jobs/ftjob-abc123/events \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.list_events(\n  fine_tuning_job_id=\"ftjob-abc123\",\n  limit=2\n)\n"
      - lang: javascript
        label: Default
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const list = await client.fineTuning.list_events(id=\"ftjob-abc123\", limit=2);\n\n  for await (const fineTune of list) {\n    console.log(fineTune);\n  }\n}\n\nmain();\n"
      - lang: curl
        label: Self-hosted
        source: "curl SELF_HOSTED_GATEWAY_URL/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F/events \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Self-hosted
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  base_url = \"SELF_HOSTED_GATEWAY_URL\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.list_events(\n  fine_tuning_job_id=\"ftjob-abc123\",\n  limit=2\n)\n"
      - lang: javascript
        label: Self-hosted
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  baseUrl: 'SELF_HOSTED_GATEWAY_URL',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const list = await client.fineTuning.list_events(id=\"ftjob-abc123\", limit=2);\n\n  for await (const fineTune of list) {\n    console.log(fineTune);\n  }\n}\n\nmain();\n"
  /fine_tuning/jobs/{fine_tuning_job_id}/cancel:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_GATEWAY_URL
      description: Self-Hosted Gateway URL
    post:
      operationId: cancelFineTuningJob
      tags:
      - Fine-tuning
      summary: 'Immediately cancel a fine-tune job.

        '
      parameters:
      - in: path
        name: fine_tuning_job_id
        required: true
        schema:
          type: string
          example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
        description: 'The ID of the fine-tuning job to cancel.

          '
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FineTuningJob'
      security:
      - Portkey-Key: []
        Virtual-Key: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
      - Portkey-Key: []
        Config: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
        Custom-Host: []
      x-code-samples:
      - lang: curl
        label: Default
        source: "curl -X POST https://api.portkey.ai/v1/fine_tuning/jobs/ftjob-abc123/cancel \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.cancel(\"ftjob-abc123\")\n"
      - lang: javascript
        label: Default
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const fineTune = await client.fineTuning.jobs.cancel(\"ftjob-abc123\");\n\n  console.log(fineTune);\n}\nmain();\n"
      - lang: curl
        label: Self-hosted
        source: "curl -X POST SELF_HOSTED_GATEWAY_URL/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F/cancel \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Self-hosted
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  base_url = \"SELF_HOSTED_GATEWAY_URL\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\nclient.fine_tuning.jobs.cancel(\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n"
      - lang: javascript
        label: Self-hosted
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  baseUrl: 'SELF_HOSTED_GATEWAY_URL',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const fineTune = await client.fineTuning.jobs.cancel(\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\");\n\n  console.log(fineTune);\n}\nmain();\n"
  /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_GATEWAY_URL
      description: Self-Hosted Gateway URL
    get:
      operationId: listFineTuningJobCheckpoints
      tags:
      - Fine-tuning
      summary: 'List checkpoints for a fine-tuning job.

        '
      parameters:
      - in: path
        name: fine_tuning_job_id
        required: true
        schema:
          type: string
          example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
        description: 'The ID of the fine-tuning job to get checkpoints for.

          '
      - name: after
        in: query
        description: Identifier for the last checkpoint ID from the previous pagination request.
        required: false
        schema:
          type: string
      - name: limit
        in: query
        description: Number of checkpoints to retrieve.
        required: false
        schema:
          type: integer
          default: 10
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListFineTuningJobCheckpointsResponse'
      security:
      - Portkey-Key: []
        Virtual-Key: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
      - Portkey-Key: []
        Config: []
      - Portkey-Key: []
        Provider-Auth: []
        Provider-Name: []
        Custom-Host: []
      x-code-samples:
      - lang: curl
        label: Default
        source: "curl https://api.portkey.ai/v1/fine_tuning/jobs/ftjob-abc123/checkpoints \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: curl
        label: Self-Hosted
        source: "curl SELF_HOSTED_GATEWAY_URL/fine_tuning/jobs/ftjob-abc123/checkpoints \\\n  -H \"x-portkey-api-key: $PORTKEY_API_KEY\" \\\n  -H \"x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY\"\n"
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\"\n)\n\ncheckpoints_list = client.fine_tuning.jobs.checkpoints.list(fine_tuning_job_id=\"<ft-job-id>\")\nprint(checkpoints_list)\n"
      - lang: javascript
        label: Default
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY'\n});\n\nasync function main() {\n  const checkpointsList = await client.fineTuning.jobs.checkpoints.list(\"<ft-job-id>\")\n  console.log(checkpointsList)\n}\n\nmain();\n"
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\nclient = Portkey(\n  api_key = \"PORTKEY_API_KEY\",\n  virtual_key = \"PROVIDER_VIRTUAL_KEY\",\n  base_url = \"SELF_HOSTED_GATEWAY_URL\"\n)\n\ncheckpoints_list = client.fine_tuning.jobs.checkpoints.list(fine_tuning_job_id=\"<ft-job-id>\")\nprint(checkpoints_list)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import Portkey from 'portkey-ai';\n\nconst client = new Portkey({\n  apiKey: 'PORTKEY_API_KEY',\n  virtualKey: 'PROVIDER_VIRTUAL_KEY',\n  baseUrl: 'SELF_HOSTED_GATEWAY_URL'\n});\n\nasync function main() {\n  const checkpointsList = await client.fineTuning.jobs.checkpoints.list(\"<ft-job-id>\")\n  console.log(checkpointsList)\n}\n\nmain();\n"
components:
  schemas:
    FineTuningJob:
      type: object
      title: FineTuningJob
      description: 'The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.

        '
      properties:
        id:
          type: string
          description: The object identifier, which can be referenced in the API endpoints.
        created_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the fine-tuning job was created.
        error:
          type: object
          nullable: true
          description: For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.
          properties:
            code:
              type: string
              description: A machine-readable error code.
            message:
              type: string
              description: A human-readable error message.
            param:
              type: string
              description: The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific.
              nullable: true
          required:
          - code
          - message
          - param
        fine_tuned_model:
          type: string
          nullable: true
          description: The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
        finished_at:
          type: integer
          nullable: true
          description: The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
        hyperparameters:
          type: object
          description: The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for more details.
          properties:
            n_epochs:
              oneOf:
              - type: string
                enum:
                - auto
              - type: integer
                minimum: 1
                maximum: 50
              default: auto
              description: 'The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.

                "auto" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs.'
          required:
          - n_epochs
        model:
          type: string
          description: The base model that is being fine-tuned.
        object:
          type: string
          description: The object type, which is always "fine_tuning.job".
          enum:
          - fine_tuning.job
        organization_id:
          type: string
          description: The organization that owns the fine-tuning job.
        result_files:
          type: array
          description: The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
          items:
            type: string
            example: file-abc123
        status:
          type: string
          description: The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.
          enum:
          - validating_files
          - queued
          - running
          - succeeded
          - failed
          - cancelled
        trained_tokens:
          type: integer
          nullable: true
          description: The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
        training_file:
          type: string
          description: The file ID used for training. You can retrieve the training data with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
        validation_file:
          type: string
          nullable: true
          description: The file ID used for validation. You can retrieve the validation results with the [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents).
        integrations:
          type: array
          nullable: true
          description: A list of integrations to enable for this fine-tuning job.
          maxItems: 5
          items:
            oneOf:
            - $ref: '#/components/schemas/FineTuningIntegration'
            x-oaiExpandable: true
        seed:
          type: integer
          description: The seed used for the fine-tuning job.
        estimated_finish:
          type: integer
          nullable: true
          description: The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
      required:
      - created_at
      - error
      - finished_at
      - fine_tuned_model
      - hyperparameters
      - id
      - model
      - object
      - organization_id
      - result_files
      - status
      - trained_tokens
      - training_file
      - validation_file
      - seed
    ListFineTuningJobCheckpointsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/FineTuningJobCheckpoint'
        object:
          type: string
          enum:
          - list
        first_id:
          type: string
          nullable: true
        last_id:
          type: string
          nullable: true
        has_more:
          type: boolean
      required:
      - object
      - data
      - has_more
    FineTuningJobCheckpoint:
      type: object
      title: FineTuningJobCheckpoint
      description: 'The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.

        '
      properties:
        id:
          type: string
          description: The checkpoint identifier, which can be referenced in the API endpoints.
        created_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the checkpoint was created.
        fine_tuned_model_checkpoint:
          type: string
          description: The name of the fine-tuned checkpoint model that is created.
        step_number:
          type: integer
          description: The step number that the checkpoint was created at.
        metrics:
          type: object
          description: Metrics at the step number during the fine-tuning job.
          properties:
            step:
              type: number
            train_loss:
              type: number
            train_mean_token_accuracy:
              type: number
            valid_loss:
              type: number
            valid_mean_token_accuracy:
              type: number
            full_valid_loss:
              type: number
            full_valid_mean_token_accuracy:
              type: number
        fine_tuning_job_id:
          type: string
          description: The name of the fine-tuning job that this checkpoint was created from.
        object:
          type: string
          description: The object type, which is always "fine_tuning.job.checkpoint".
          enum:
          - fine_tuning.job.checkpoint
      required:
      - created_at
      - fine_tuning_job_id
      - fine_tuned_model_checkpoint
      - id
      - metrics
      - object
      - step_number
      x-code-samples:
        name: The fine-tuning job checkpoint object
        example: "{\n  \"object\": \"fine_tuning.job.checkpoint\",\n  \"id\": \"ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P\",\n  \"created_at\": 1712211699,\n  \"fine_tuned_model_checkpoint\": \"ft:gpt-3.5-turbo-0125:my-org:custom_suffix:9ABel2dg:ckpt-step-88\",\n  \"fine_tuning_job_id\": \"ftjob-fpbNQ3H1GrMehXRf8cO97xTN\",\n  \"metrics\": {\n    \"step\": 88,\n    \"train_loss\": 0.478,\n    \"train_mean_token_accuracy\": 0.924,\n    \"valid_loss\": 10.112,\n    \"valid_mean_token_accuracy\": 0.145,\n    \"full_valid_loss\": 0.567,\n    \"full_valid_mean_token_accuracy\": 0.944\n  },\n  \"step_number\": 88\n}\n"
    ListFineTuningJobEventsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/FineTuningJobEvent'
        object:
          type: string
          enum:
          - list
      required:
      - object
      - data
    FineTuningIntegration:
      type: object
      title: Fine-Tuning Job Integration
      required:
      - type
      - wandb
      properties:
        type:
          type: string
          description: The type of the integration being enabled for the fine-tuning job
          enum:
          - wandb
        wandb:
          type: object
          description: 'The settings for your integration with Weights and Biases. This payload specifies the project that

            metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags

            to your run, and set a default entity (team, username, etc) to be associated with your run.

            '
          required:
          - project
          properties:
            project:
              description: 'The name of the project that the new run will be created under.

                '
              type: string
              example: my-wandb-project
            name:
              description: 'A display name to set for the run. If not set, we will use the Job ID as the name.

                '
              nullable: true
              type: string
            entity:
              description: 'The entity to use for the run. This allows you to set the team or username of the WandB user that you would

                like associated with the run. If not set, the default entity for the registered WandB API key is used.

                '
              nullable: true
              type: string
            tags:
              description: 'A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some

                default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".

                '
              type: array
              items:
                type: string
                example: custom-tag
    FineTuningJobEvent:
      type: object
      description: Fine-tuning job event object
      properties:
        id:
          type: string
        created_at:
          type: integer
        level:
          type: string
          enum:
          - info
          - warn
          - error
        message:
          type: string
        object:
          type: string
          enum:
          - fine_tuning.job.event
      required:
      - id
      - object
      - created_at
      - level
      - message
      x-code-samples:
        name: The fine-tuning job event object
        example: "{\n  \"object\": \"fine_tuning.job.event\",\n  \"id\": \"ftevent-abc123\"\n  \"created_at\": 1677610602,\n  \"level\": \"info\",\n  \"message\": \"Created fine-tuning job\"\n}\n"
    ListPaginatedFineTuningJobsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/FineTuningJob'
        has_more:
          type: boolean
        object:
          type: string
          enum:
          - list
      required:
      - object
      - data
      - has_more
  securitySchemes:
    Portkey-Key:
      type: apiKey
      in: header
      name: x-portkey-api-key
    Virtual-Key:
      type: apiKey
      in: header
      name: x-portkey-virtual-key
    Provider-Auth:
      type: http
      scheme: bearer
    Provider-Name:
      type: apiKey
      in: header
      name: x-portkey-provider
    Config:
      type: apiKey
      in: header
      name: x-portkey-config
    Custom-Host:
      type: apiKey
      in: header
      name: x-portkey-custom-host
x-server-groups:
  ControlPlaneServers:
  - url: https://api.portkey.ai/v1
    description: Portkey API Public Endpoint
  - url: SELF_HOSTED_CONTROL_PLANE_URL
    description: Self-Hosted Control Plane URL
  DataPlaneServers:
  - url: https://api.portkey.ai/v1
    description: Portkey API Public Endpoint
  - url: SELF_HOSTED_GATEWAY_URL
    description: Self-Hosted Gateway URL
  PublicServers:
  - url: https://api.portkey.ai
    description: Portkey Public API (no auth required)
x-mint:
  mcp:
    enabled: true
    name: Portkey MCP
    description: Official MCP Server for Portkey Docs & APIs
x-code-samples:
  navigationGroups:
  - id: endpoints
    title: Endpoints
  - id: assistants
    title: Assistants
  - id: legacy
    title: Legacy
  groups:
  - id: audio
    title: Audio
    description: 'Learn how to turn audio into text or text into audio.


      Related guide: [Speech to text](https://platform.openai.com/docs/guides/speech-to-text)

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: createSpeech
      path: createSpeech
    - type: endpoint
      key: createTranscription
      path: createTranscription
    - type: endpoint
      key: createTranslation
      path: createTranslation
    - type: object
      key: CreateTranscriptionResponseJson
      path: json-object
    - type: object
      key: CreateTranscriptionResponseVerboseJson
      path: verbose-json-object
  - id: chat
    title: Chat
    description: 'Given a list of messages comprising a conversation, the model will return a response.


      Related guide: [Chat Completions](https://platform.openai.com/docs/guides/text-generation)

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: createChatCompletion
      path: create
    - type: object
      key: CreateChatCompletionResponse
      path: object
    - type: object
      key: CreateChatCompletionStreamResponse
      path: streaming
  - id: realtime
    title: Realtime
    description: 'WebSocket proxy for provider Realtime APIs (`GET` upgrade). Use `wss://` with the same `/v1` data-plane base as other gateway routes.


      Related guide: [OpenAI Realtime API](https://platform.openai.com/docs/guides/realtime)

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: connectRealtime
      path: connect
  - id: embeddings
    title: Embeddings
    description: 'Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.


      Related guide: [Embeddings](https://platform.openai.com/docs/guides/embeddings)

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: createEmbedding
      path: create
    - type: object
      key: Embedding
      path: object
  - id: rerank
    title: Rerank
    description: 'Rerank a list of documents based on their relevance to a query. Reranking improves search results by scoring documents based on semantic relevance rather than keyword matching.


      Supported providers: Cohere, Voyage, Jina, Pinecone, Bedrock, Azure AI.

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: createRerank
      path: create
    - type: object
      key: CreateRerankResponse
      path: object
  - id: fine-tuning
    title: Fine-tuning
    description: 'Manage fine-tuning jobs to tailor a model to your specific training data.


      Related guide: [Fine-tune models](https://platform.openai.com/docs/guides/fine-tuning)

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: createFineTuningJob
      path: create
    - type: endpoint
      key: listPaginatedFineTuningJobs
      path: list
    - type: endpoint
      key: listFineTuningEvents
      path: list-events
    - type: endpoint
      key: listFineTuningJobCheckpoints
      path: list-checkpoints
    - type: endpoint
      key: retrieveFineTuningJob
      path: retrieve
    - type: endpoint
      key: can

# --- truncated at 32 KB (42 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/portkey/refs/heads/main/openapi/portkey-fine-tuning-api-openapi.yml