Portkey Virtual-keys API

Create, List, Retrieve, Update, and Delete your Portkey Virtual keys.

OpenAPI Specification

portkey-virtual-keys-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Portkey Analytics > Graphs Virtual-keys 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: Virtual-keys
  description: Create, List, Retrieve, Update, and Delete your Portkey Virtual keys.
paths:
  /virtual-keys:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_CONTROL_PLANE_URL
      description: Self-Hosted Control Plane URL
    get:
      summary: List All Virtual Keys
      tags:
      - Virtual-keys
      parameters:
      - in: query
        name: current_page
        schema:
          type: integer
        required: true
        description: Current page, defaults to 0
      - in: query
        name: page_size
        schema:
          type: integer
        required: true
        description: Page size, default to 50
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    enum:
                    - list
                  total:
                    type: integer
                    description: Total number of virtual keys
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/VirtualKeys'
        '401':
          description: Unauthorized response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      message:
                        type: string
              example:
                success: false
                data:
                  message: Unauthorised Request
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# List virtual keys\nvirtual_keys = portkey.virtual_keys.list()\n\nprint(virtual_keys)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst virtualKeys=await portkey.virtualKeys.list({})\nconsole.log(virtualKeys);\n"
      - lang: curl
        label: Default
        source: 'curl -X GET https://api.portkey.ai/v1/virtual-keys \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# List virtual keys\nvirtual_keys = portkey.virtual_keys.list()\n\nprint(virtual_keys)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    virtualKey: \"PROVIDER_VIRTUAL_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst virtualKeys=await portkey.virtualKeys.list({})\nconsole.log(virtualKeys);\n"
      - lang: curl
        label: Self-Hosted
        source: 'curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys \

          -H "x-portkey-api-key: PORTKEY_API_KEY" \

          -H "x-portkey-virtual-key: PROVIDER_VIRTUAL_KEY"

          '
    post:
      summary: Create a Virtual Key
      tags:
      - Virtual-keys
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                provider:
                  type: string
                  enum:
                  - openai
                  - azure-openai
                  - ai21
                  - anthropic
                  - anyscale
                  - azure-openai
                  - bedrock
                  - cohere
                  - deepinfra
                  - fireworks-ai
                  - google
                  - groq
                  - hugging-face
                  - jina
                  - lingyi
                  - mistral-ai
                  - monsterapi
                  - moonshot
                  - nomic
                  - novita-ai
                  - open-ai
                  - openrouter
                  - palm
                  - perplexity-ai
                  - predibase
                  - reka-ai
                  - segmind
                  - stability-ai
                  - together-ai
                  - vertex-ai
                  - workers-ai
                  - zhipu
                key:
                  type: string
                note:
                  type: string
                  nullable: true
                apiVersion:
                  type: string
                  nullable: true
                resourceName:
                  type: string
                  nullable: true
                deploymentName:
                  type: string
                  nullable: true
                workspace_id:
                  type: string
                  format: uuid
                  description: optional, needed when using organisation admin API keys
                deploymentConfig:
                  type: array
                  items:
                    type: object
                    properties:
                      apiVersion:
                        type: string
                      alias:
                        type: string
                      is_default:
                        type: boolean
                      deploymentName:
                        type: string
                    required:
                    - apiVersion
                    - deploymentName
                usage_limits:
                  $ref: '#/components/schemas/UsageLimits'
                rate_limits:
                  $ref: '#/components/schemas/RateLimits'
                expires_at:
                  type: string
                  format: date-time
                secret_mappings:
                  type: array
                  items:
                    $ref: '#/components/schemas/SecretMapping'
                  description: Dynamically resolve secrets from secret references at runtime. Valid target_field values are "key" or "model_config.<field>" (e.g. "model_config.awsSecretAccessKey"). Each target_field must be unique. When "key" is mapped, the key field becomes optional.
            examples:
              generic:
                value:
                  name: My first virtual key
                  provider: openai
                  key: sk-jhkfkjs8d9f7jksfghkjhfg
                  note: Virtual key description
                  usage_limits:
                    credit_limit: 10
                    periodic_reset: monthly
                    alert_threshold: 9
                  workspace_id: ''
              azure-openai:
                value:
                  provider: azure-openai
                  key: openai-test
                  name: Key 1 Azure Open AI
                  note: description
                  deploymentConfig:
                  - apiVersion: a
                    alias: b
                    deploymentName: c
                    is_default: true
                  - apiVersion: a
                    alias: b
                    deploymentName: c
                    is_default: false
                  resourceName: c
              bedrock:
                value:
                  provider: bedrock
                  key: openai-test
                  name: Bedrock Key
                  note: description
                  awsAccessKeyId: a
                  awsSecretAccessKey: b
                  awsRegion: c
              vertex-ai:
                value:
                  provider: vertex-ai
                  key: vertex test
                  name: Vertex AI Key
                  note: description
                  vertexProjectId: a
                  vertexRegion: b
              workers-ai:
                value:
                  provider: vertex-ai
                  key: cloudflare test
                  name: CF Workers AI Key
                  note: description
                  workersAiAccountId: a
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      slug:
                        type: string
        '401':
          description: Unauthorized response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      message:
                        type: string
              example:
                success: false
                data:
                  message: Unauthorised Request
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Add a new virtual key\nnew_virtual_key = portkey.virtual_keys.create(\n    name=\"openaiVKey\",\n    provider=\"openai\",\n    key=\"PROVIDER_API_KEY\"\n)\n\nprint(new_virtual_key)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst newVkey=await portkey.virtualKeys.create({\n    name:\"openaiVKey\",\n    provider:\"openai\",\n    key:\"PROVIDER_API_KEY\",\n})\nconsole.log(newVkey);\n"
      - lang: curl
        label: Default
        source: "curl -X POST https://api.portkey.ai/v1/virtual-keys \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"name\": \"openaiVKey\",\n    \"provider\": \"openai\",\n    \"key\": \"PROVIDER_API_KEY\"\n}'\n"
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Add a new virtual key\nnew_virtual_key = portkey.virtual_keys.create(\n    name=\"openaiVKey\",\n    provider=\"openai\",\n    key=\"PROVIDER_API_KEY\"\n)\n\nprint(new_virtual_key)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst newVkey=await portkey.virtualKeys.create({\n    name:\"openaiVKey\",\n    provider:\"openai\",\n    key:\"PROVIDER_API_KEY\",\n})\nconsole.log(newVkey);\n"
      - lang: curl
        label: Self-Hosted
        source: "curl -X POST SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"name\": \"openaiVKey\",\n    \"provider\": \"openai\",\n    \"key\": \"PROVIDER_API_KEY\"\n}'\n"
  /virtual-keys/{slug}:
    servers:
    - url: https://api.portkey.ai/v1
      description: Portkey API Public Endpoint
    - url: SELF_HOSTED_CONTROL_PLANE_URL
      description: Self-Hosted Control Plane URL
    get:
      summary: Get a Virtual Key
      tags:
      - Virtual-keys
      parameters:
      - in: path
        name: slug
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualKeys'
        '401':
          description: Unauthorized response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      message:
                        type: string
              example:
                success: false
                data:
                  message: Unauthorised Request
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Get a specific virtual key\nvirtual_key = portkey.virtual_keys.retrieve(\n    slug='VIRTUAL_KEY_SLUG'\n)\n\nprint(virtual_key)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst vKey=await portkey.virtualKeys.retrieve({\n    slug:'VIRTUAL_KEY_SLUG'\n})\nconsole.log(vKey);\n"
      - lang: curl
        label: Default
        source: 'curl -X GET https://api.portkey.ai/v1/virtual-keys/VIRTUAL_KEY_SLUG \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X GET SELF_HOSTED_CONTROL_PLANE_URL/virtual-keys/VIRTUAL_KEY_SLUG \

          -H "x-portkey-api-key: PORTKEY_API_KEY"

          '
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Get a specific virtual key\nvirtual_key = portkey.virtual_keys.retrieve(\n    slug='VIRTUAL_KEY_SLUG'\n)\n\nprint(virtual_key)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst vKey=await portkey.virtualKeys.retrieve({\n    slug:'VIRTUAL_KEY_SLUG'\n})\nconsole.log(vKey);\n"
    put:
      summary: Update a Virtual Key
      tags:
      - Virtual-keys
      parameters:
      - in: path
        name: slug
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                key:
                  type: string
                note:
                  type: string
                  nullable: true
                deploymentConfig:
                  type: array
                  items:
                    type: object
                    properties:
                      apiVersion:
                        type: string
                      alias:
                        type: string
                      is_default:
                        type: boolean
                      deploymentName:
                        type: string
                    required:
                    - apiVersion
                    - deploymentName
                usage_limits:
                  $ref: '#/components/schemas/UsageLimits'
                secret_mappings:
                  type: array
                  items:
                    $ref: '#/components/schemas/SecretMapping'
                  description: Dynamically resolve secrets from secret references at runtime. Valid target_field values are "key" or "model_config.<field>" (e.g. "model_config.awsSecretAccessKey"). Each target_field must be unique.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Unauthorized response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      message:
                        type: string
              example:
                success: false
                data:
                  message: Unauthorised Request
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Update a specific virtual key\nupdated_virtual_key = portkey.virtual_keys.update(\n    slug='VIRTUAL_KEY_SLUG',\n    name=\"openaiVKey\",\n    note=\"hello\",\n    rate_limits=[{\"type\": \"requests\", \"unit\": \"rpm\", \"value\": 696}]\n)\n\nprint(updated_virtual_key)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst updatedVKey=await portkey.virtualKeys.update({\n    slug:'VIRTUAL_KEY_SLUG',\n    name:\"openaiVKey\",\n    note:\"hello\",\n    rate_limits: [{type: \"requests\", unit: \"rpm\", value: 696}]\n})\nconsole.log(updatedVKey);\n"
      - lang: curl
        label: Default
        source: "curl -X PUT \"https://api.portkey.ai/v1/virtual_keys/VIRTUAL_KEY_SLUG\" \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"name\": \"openaiVKey\",\n    \"note\": \"hello\",\n    \"rate_limits\": [\n        {\n            \"type\": \"requests\",\n            \"unit\": \"rpm\",\n            \"value\": 696\n        }\n    ]\n}'\n"
      - lang: curl
        label: Self-Hosted
        source: "curl -X PUT \"SELF_HOSTED_CONTROL_PLANE_URL/virtual_keys/VIRTUAL_KEY_SLUG\" \\\n-H \"x-portkey-api-key: PORTKEY_API_KEY\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\n    \"name\": \"openaiVKey\",\n    \"note\": \"hello\",\n    \"rate_limits\": [\n        {\n            \"type\": \"requests\",\n            \"unit\": \"rpm\",\n            \"value\": 696\n        }\n    ]\n}'\n"
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Update a specific virtual key\nupdated_virtual_key = portkey.virtual_keys.update(\n    slug='VIRTUAL_KEY_SLUG',\n    name=\"openaiVKey\",\n    note=\"hello\",\n    rate_limits=[{\"type\": \"requests\", \"unit\": \"rpm\", \"value\": 696}]\n)\n\nprint(updated_virtual_key)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst updatedVkey=await portkey.virtualKeys.update({\n    slug:'VIRTUAL_KEY_SLUG',\n    name:\"openaiVKey\",\n    note:\"hello\",\n    rate_limits: [{type: \"requests\", unit: \"rpm\", value: 696}]\n})\nconsole.log(updatedVkey);\n"
    delete:
      summary: Delete a Virtual Key
      tags:
      - Virtual-keys
      parameters:
      - in: path
        name: slug
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Unauthorized response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      message:
                        type: string
              example:
                success: false
                data:
                  message: Unauthorised Request
      x-code-samples:
      - lang: python
        label: Default
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n)\n\n# Delete a specific virtual key\nresult = portkey.virtual_keys.delete(\n    slug='VIRTUAL_KEY_SLUG'\n)\n\nprint(result)\n"
      - lang: javascript
        label: Default
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n})\n\nconst result=await portkey.virtualKeys.delete({\n    slug:'VIRTUAL_KEY_SLUG',\n})\nconsole.log(result);\n"
      - lang: curl
        label: Default
        source: 'curl -X DELETE https://api.portkey.ai/v1/virtual_keys/VIRTUAL_KEY_SLUG

          '
      - lang: curl
        label: Self-Hosted
        source: 'curl -X DELETE https://SELF_HOSTED_CONTROL_PLANE_URL/virtual_keys/VIRTUAL_KEY_SLUG

          '
      - lang: python
        label: Self-Hosted
        source: "from portkey_ai import Portkey\n\n# Initialize the Portkey client\nportkey = Portkey(\n    api_key=\"PORTKEY_API_KEY\",\n    base_url=\"SELF_HOSTED_CONTROL_PLANE_URL\"\n)\n\n# Delete a specific virtual key\nresult = portkey.virtual_keys.delete(\n    slug='VIRTUAL_KEY_SLUG'\n)\n\nprint(result)\n"
      - lang: javascript
        label: Self-Hosted
        source: "import { Portkey } from \"portkey-ai\";\n\nconst portkey = new Portkey({\n    apiKey: \"PORTKEY_API_KEY\",\n    baseUrl: \"SELF_HOSTED_CONTROL_PLANE_URL\"\n})\n\nconst result=await portkey.virtualKeys.delete({\n    slug:'VIRTUAL_KEY_SLUG',\n})\nconsole.log(result);\n"
components:
  schemas:
    SecretMapping:
      type: object
      required:
      - target_field
      - secret_reference_id
      properties:
        target_field:
          type: string
          description: 'The field on the entity to populate from the secret reference. Must be unique within the array.

            - **Integrations**: `key` or `configurations.<field>` (e.g. `configurations.aws_secret_access_key`)

            - **Virtual Keys**: `key` or `model_config.<field>` (e.g. `model_config.awsSecretAccessKey`)

            '
          example: key
        secret_reference_id:
          type: string
          description: UUID or slug of the secret reference. Must belong to the same organisation and be accessible by the workspace.
          example: my-aws-secret
        secret_key:
          type: string
          nullable: true
          description: Override the secret_key defined on the secret reference. Use to pick a specific key from a multi-value secret.
    VirtualKeys:
      type: object
      properties:
        name:
          type: string
          example: Open AI Workspace
        note:
          type: string
          nullable: true
          example: randomness
        status:
          type: string
          enum:
          - active
          - exhausted
        usage_limits:
          $ref: '#/components/schemas/UsageLimits'
        reset_usage:
          type: number
          nullable: true
          example: 0
        created_at:
          type: string
          format: date-time
        slug:
          type: string
        model_config:
          type: object
        rate_limits:
          type: array
          items:
            $ref: '#/components/schemas/RateLimits'
          nullable: true
        expires_at:
          type: string
          format: date-time
        secret_mappings:
          type: array
          items:
            $ref: '#/components/schemas/SecretMapping'
          description: Secret reference mappings for this virtual key. Valid target_field values are "key" or "model_config.<field>".
        object:
          type: string
          enum:
          - virtual-key
    UsageLimits:
      type: object
      properties:
        credit_limit:
          type: integer
          description: Credit Limit. Used for tracking usage
          minimum: 1
          default: null
        type:
          type: string
          description: Type of credit limit
          enum:
          - cost
          - tokens
        alert_threshold:
          type: integer
          description: Alert Threshold. Used for alerting when usage reaches more than this
          minimum: 1
          default: null
        periodic_reset:
          type: string
          description: Reset the usage periodically.
          enum:
          - monthly
          - weekly
          nullable: true
          example: monthly
        periodic_reset_days:
          type: integer
          description: Reset the usage counter every N days (1-365). Mutually exclusive with periodic_reset.
          minimum: 1
          maximum: 365
          nullable: true
          example: 30
        next_usage_reset_at:
          type: string
          format: date-time
          description: ISO 8601 datetime for the next scheduled usage reset. Auto-computed from periodic_reset or periodic_reset_days if not provided.
          nullable: true
          example: '2026-05-01T00:00:00Z'
      example:
        credit_limit: 10
        periodic_reset: monthly
        alert_threshold: 8
    RateLimits:
      type: object
      properties:
        type:
          type: string
          enum:
          - requests
          - tokens
        unit:
          type: string
          enum:
          - rpd
          - rph
          - rpm
        value:
          type: integer
  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: cancelFineTuningJob
      path: cancel
    - type: object
      key: FinetuneChatRequestInput
      path: chat-input
    - type: object
      key: FinetuneCompletionRequestInput
      path: completions-input
    - type: object
      key: FineTuningJob
      path: object
    - type: object
      key: FineTuningJobEvent
      path: event-object
    - type: object
      key: FineTuningJobCheckpoint
      path: checkpoint-object
  - id: batch
    title: Batch
    description: 'Create large batches of API requests for asynchronous processing. The Batch API returns completions within 24 hours for a 50% discount.


      Related guide: [Batch](https://platform.openai.com/docs/guides/batch)

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: createBatch
      path: create
    - type: endpoint
      key: retrieveBatch
      path: retrieve
    - type: endpoint
      key: cancelBatch
      path: cancel
    - type: endpoint
      key: listBatches
      path: list
    - type: object
      key: Batch
      path: object
    - type: object
      key: BatchRequestInput
      path: request-input
    - type: object
      key: BatchRequestOutput
      path: request-output
  - id: files
    title: Files
    description: 'Files are used to upload documents that can be used with features like [Assistants](https://platform.openai.com/docs/api-reference/assistants), [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning), and [Batch API](https://platform.openai.com/docs/guides/batch).

      '
    navigationGroup: endpoints
    sections:
    - type: endpoint
      key: createFile
      path: create
    - type: endpoint
      key: listFiles
      path: list
    - type: endpoint
      key: retrieveFile
      path: retrieve
    - type: endpoint
      key: deleteFile
      path: delete
    - type: endpoint
      key: downloadFile
      path: retri

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