> ## Documentation Index
> Fetch the complete documentation index at: https://docs.costgraph.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update an AI gateway connection

> Amends the pricing and collection settings of an AI gateway connection. Every field is optional: an omitted field is left alone, and an empty one clears it. A gateway that runs the model itself is amortized from the containers of the very pods it is scraped from, so scrape_namespace and scrape_label_selector are what an unpriced model falls back to. tenant_map turns raw sub-account values into display names. Setting cluster_id moves the connection to telemetry so the operator scrapes it, and setting instance_id moves it to telemetry the host agent scrapes; clearing both moves the connection back to push.



## OpenAPI

````yaml /api-reference/costgraph/openapi.json patch /integrations/connections/{id}/ai-gateway
openapi: 3.0.0
info:
  description: Read and manage your CostGraph organization, spend, alerts, and settings.
  title: CostGraph API
  contact: {}
  version: '1.0'
servers:
  - url: https://api.costgraph.ai
security: []
tags:
  - name: ai
    x-group: AI
  - name: ai-serving
    x-group: AI serving
  - name: anomalies
    x-group: Anomalies
  - name: auth
    x-group: Auth
  - name: billing
    x-group: Billing
  - name: billing-export
    x-group: Billing export
  - name: budgets
    x-group: Budgets
  - name: ci
    x-group: CI
  - name: compute-recommendations
    x-group: Compute recommendations
  - name: config
    x-group: Config
  - name: cost
    x-group: Cost
  - name: gpus
    x-group: GPUs
  - name: graphai
    x-group: Graph AI
  - name: infracost
    x-group: Infracost
  - name: integrations
    x-group: Integrations
  - name: invitations
    x-group: Invitations
  - name: kubernetes-clusters
    x-group: Kubernetes clusters
  - name: marketplace
    x-group: Marketplace
  - name: network-requests
    x-group: Network requests
  - name: notifications
    x-group: Notifications
  - name: oauth
    x-group: OAuth
  - name: oauth-clients
    x-group: OAuth clients
  - name: opencost
    x-group: OpenCost
  - name: organization
    x-group: Audit log
  - name: organizations
    x-group: Organizations
  - name: placement-alternatives
    x-group: Placement alternatives
  - name: reports
    x-group: Reports
  - name: service-map
    x-group: Service map
  - name: settings
    x-group: Settings
  - name: sso
    x-group: Single sign-on
  - name: tenants
    x-group: Tenants
  - name: user
    x-group: Users
  - name: virtual-machines
    x-group: Virtual machines
  - name: virtual-tags
    x-group: Virtual tags
  - name: workflows
    x-group: Workflows
paths:
  /integrations/connections/{id}/ai-gateway:
    patch:
      tags:
        - integrations
      summary: Update an AI gateway connection
      description: >-
        Amends the pricing and collection settings of an AI gateway connection.
        Every field is optional: an omitted field is left alone, and an empty
        one clears it. A gateway that runs the model itself is amortized from
        the containers of the very pods it is scraped from, so scrape_namespace
        and scrape_label_selector are what an unpriced model falls back to.
        tenant_map turns raw sub-account values into display names. Setting
        cluster_id moves the connection to telemetry so the operator scrapes it,
        and setting instance_id moves it to telemetry the host agent scrapes;
        clearing both moves the connection back to push.
      parameters:
        - description: Connection id
          name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/integrations.aiGatewayUpdateRequest'
        description: Gateway settings
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.SuccessResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
components:
  schemas:
    integrations.aiGatewayUpdateRequest:
      type: object
      properties:
        cluster_id:
          type: string
        instance_id:
          type: string
        scrape_label_selector:
          type: string
        scrape_namespace:
          type: string
        scrape_port:
          type: integer
        tenant_map:
          type: object
          additionalProperties:
            type: string
    responses.SuccessResponse:
      type: object
      required:
        - message
        - status
      properties:
        data: {}
        message:
          type: string
          example: some message
        status:
          type: string
          example: success
    responses.ErrorResponse:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          example: some message
        status:
          type: string
          example: error

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.