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

# Deploy Model

> Provisions a model after billing checks and forwards to ModelService.



## OpenAPI

````yaml /tensormesh-api/specs/billing/v1/billing_model_service.openapi.json post /v1/models
openapi: 3.0.3
info:
  title: Tensormesh Control Plane API (billing/v1/billing_model_service)
  version: 0.1.0
  description: >-
    Authentication: Authorization: Bearer <access_token> (obtain via tm auth
    login).
servers:
  - url: https://api.tensormesh.ai
security:
  - BearerAuth: []
tags:
  - name: BillingModelService
paths:
  /v1/models:
    post:
      tags:
        - BillingModelService
      summary: Deploy Model
      description: Provisions a model after billing checks and forwards to ModelService.
      operationId: BillingModelService_DeployModel
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1DeployModelRequest'
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1DeployModelResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
components:
  schemas:
    v1DeployModelRequest:
      type: object
      properties:
        modelName:
          type: string
          description: Model nick name. Must be unique per user.
        userId:
          type: string
          description: User ID who owns this model. Must be a valid UUID.
        description:
          type: string
          description: Optional description of the model.
        infra:
          $ref: '#/components/schemas/v1Infra'
        modelPath:
          type: string
          description: Model path (e.g., HuggingFace model ID).
        gpuCount:
          type: integer
          format: int64
          description: Number of GPUs to allocate for this model.
        gpuType:
          $ref: '#/components/schemas/v1GPUType'
        modelSpec:
          type: object
          description: Additional model-specific configuration.
        apiKey:
          type: string
          title: User api key optional
        hfToken:
          type: string
          title: User HF token optional
        kvCacheEnabled:
          type: boolean
          description: Enable KV cache.
        cpuOffloadingEnabled:
          type: boolean
          description: Enable CPU offloading.
        nodeId:
          type: string
          title: Node ID optional
    v1DeployModelResponse:
      type: object
      properties:
        model:
          $ref: '#/components/schemas/v1Model'
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
          description: |-
            The status code, which should be an enum value of
            [google.rpc.Code][google.rpc.Code].
        message:
          type: string
          description: >-
            A developer-facing error message, which should be in English. Any

            user-facing error message should be localized and sent in the

            [google.rpc.Status.details][google.rpc.Status.details] field, or
            localized

            by the client.
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
          description: >-
            A list of messages that carry the error details.  There is a common
            set of

            message types for APIs to use.
      description: >-
        The `Status` type defines a logical error model that is suitable for

        different programming environments, including REST APIs and RPC APIs. It
        is

        used by [gRPC](https://github.com/grpc). Each `Status` message contains

        three pieces of data: error code, error message, and error details.


        You can find out more about this error model and how to work with it in
        the

        [API Design Guide](https://cloud.google.com/apis/design/errors).
    v1Infra:
      type: object
      properties:
        cloudProvider:
          $ref: '#/components/schemas/v1CloudProvider'
        nebiusRegion:
          $ref: '#/components/schemas/v1NebiusRegion'
        lambdaRegion:
          $ref: '#/components/schemas/v1LambdaRegion'
        onpremRegion:
          type: string
      description: >-
        Infra specifies the infrastructure configuration for deploying and
        running

        models.


        This message defines where a model deployment should run by specifying
        both

        the cloud provider and the specific region. It uses a oneof for region

        selection to ensure type-safe region specification based on the chosen

        provider.


        See also: tensormesh/common/v1/cloud_provider.proto for provider and
        region

        enum definitions
    v1GPUType:
      type: string
      enum:
        - GPU_TYPE_UNSPECIFIED
        - GPU_TYPE_A100
        - GPU_TYPE_H100
        - GPU_TYPE_H200
        - GPU_TYPE_B200
      default: GPU_TYPE_UNSPECIFIED
      description: >-
        GPUType specifies the type of GPU to use for a model deployment.


        This enum defines the supported GPU types for model deployments. It
        allows

        clients to specify the exact GPU hardware they need for their models.


        enum definitions
    v1Model:
      type: object
      properties:
        modelId:
          type: string
          title: unique identifier for the model instance
        deploymentId:
          type: string
          title: deployment id associated with the model
        userId:
          type: string
          description: User ID who owns this deployment.
        description:
          type: string
          description: Description of the deployment.
        modelPath:
          type: string
          description: Model path.
        modelName:
          type: string
          description: Display the nick name for the model.
        status:
          $ref: '#/components/schemas/v1ModelStatus'
        events:
          type: array
          items:
            $ref: '#/components/schemas/v1ModelEvent'
          description: List of events that occurred during deployment lifecycle.
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the model was created.
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the model was last updated.
        modelSpec:
          type: object
          title: model specification
        infra:
          $ref: '#/components/schemas/v1Infra'
        gpuCount:
          type: integer
          format: int64
          description: Number of GPUs allocated for this model.
        gpuType:
          $ref: '#/components/schemas/v1GPUType'
        replicas:
          type: integer
          format: int64
          title: Number of replicas for this model
        endpoint:
          type: string
          title: endpoint to connect with this model
        apiKey:
          type: string
          title: api key used for authorizing the request to this model
      description: Model represents a model instance created by user.
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
          description: >-
            A URL/resource name that uniquely identifies the type of the
            serialized

            protocol buffer message. This string must contain at least

            one "/" character. The last segment of the URL's path must represent

            the fully qualified name of the type (as in

            `path/google.protobuf.Duration`). The name should be in a canonical
            form

            (e.g., leading "." is not accepted).


            In practice, teams usually precompile into the binary all types that
            they

            expect it to use in the context of Any. However, for URLs which use
            the

            scheme `http`, `https`, or no scheme, one can optionally set up a
            type

            server that maps type URLs to message definitions as follows:


            * If no scheme is provided, `https` is assumed.

            * An HTTP GET on the URL must yield a [google.protobuf.Type][]
              value in binary format, or produce an error.
            * Applications are allowed to cache lookup results based on the
              URL, or have them precompiled into a binary to avoid any
              lookup. Therefore, binary compatibility needs to be preserved
              on changes to types. (Use versioned type names to manage
              breaking changes.)

            Note: this functionality is not currently available in the official

            protobuf release, and it is not used for type URLs beginning with

            type.googleapis.com. As of May 2023, there are no widely used type
            server

            implementations and no plans to implement one.


            Schemes other than `http`, `https` (or the empty scheme) might be

            used with implementation specific semantics.
      additionalProperties: {}
      description: >-
        `Any` contains an arbitrary serialized protocol buffer message along
        with a

        URL that describes the type of the serialized message.


        Protobuf library provides support to pack/unpack Any values in the form

        of utility functions or additional generated methods of the Any type.


        Example 1: Pack and unpack a message in C++.

            Foo foo = ...;
            Any any;
            any.PackFrom(foo);
            ...
            if (any.UnpackTo(&foo)) {
              ...
            }

        Example 2: Pack and unpack a message in Java.

            Foo foo = ...;
            Any any = Any.pack(foo);
            ...
            if (any.is(Foo.class)) {
              foo = any.unpack(Foo.class);
            }
            // or ...
            if (any.isSameTypeAs(Foo.getDefaultInstance())) {
              foo = any.unpack(Foo.getDefaultInstance());
            }

         Example 3: Pack and unpack a message in Python.

            foo = Foo(...)
            any = Any()
            any.Pack(foo)
            ...
            if any.Is(Foo.DESCRIPTOR):
              any.Unpack(foo)
              ...

         Example 4: Pack and unpack a message in Go

             foo := &pb.Foo{...}
             any, err := anypb.New(foo)
             if err != nil {
               ...
             }
             ...
             foo := &pb.Foo{}
             if err := any.UnmarshalTo(foo); err != nil {
               ...
             }

        The pack methods provided by protobuf library will by default use

        'type.googleapis.com/full.type.name' as the type URL and the unpack

        methods only use the fully qualified type name after the last '/'

        in the type URL, for example "foo.bar.com/x/y.z" will yield type

        name "y.z".


        JSON

        ====

        The JSON representation of an `Any` value uses the regular

        representation of the deserialized, embedded message, with an

        additional field `@type` which contains the type URL. Example:

            package google.profile;
            message Person {
              string first_name = 1;
              string last_name = 2;
            }

            {
              "@type": "type.googleapis.com/google.profile.Person",
              "firstName": <string>,
              "lastName": <string>
            }

        If the embedded message type is well-known and has a custom JSON

        representation, that representation will be embedded adding a field

        `value` which holds the custom JSON in addition to the `@type`

        field. Example (for message [google.protobuf.Duration][]):

            {
              "@type": "type.googleapis.com/google.protobuf.Duration",
              "value": "1.212s"
            }
    v1CloudProvider:
      type: string
      enum:
        - CLOUD_PROVIDER_UNSPECIFIED
        - CLOUD_PROVIDER_ONPREM
        - CLOUD_PROVIDER_NEBIUS
        - CLOUD_PROVIDER_LAMBDA
        - CLOUD_PROVIDER_YOTTA
      default: CLOUD_PROVIDER_UNSPECIFIED
      description: >-
        CloudProvider specifies which cloud infrastructure provider to use for
        deployment.


        Currently supported providers:
          - On-premise infrastructure (self-hosted)
          - Nebius (https://nebius.com) - European and US cloud GPU provider
          - Lambda Labs (https://lambdalabs.com) - US-based GPU cloud provider
          - Yotta provider
    v1NebiusRegion:
      type: string
      enum:
        - NEBIUS_REGION_UNSPECIFIED
        - NEBIUS_REGION_EU_NORTH_1
        - NEBIUS_REGION_EU_WEST_1
        - NEBIUS_REGION_US_CENTRAL_1
      default: NEBIUS_REGION_UNSPECIFIED
      description: >-
        NebiusRegion specifies the geographic region for Nebius cloud
        deployments.
    v1LambdaRegion:
      type: string
      enum:
        - LAMBDA_REGION_UNSPECIFIED
        - LAMBDA_REGION_US_SOUTH_1
        - LAMBDA_REGION_US_SOUTH_2
        - LAMBDA_REGION_US_SOUTH_3
        - LAMBDA_REGION_EAST_1
        - LAMBDA_REGION_MIDWEST_1
      default: LAMBDA_REGION_UNSPECIFIED
      description: |-
        LambdaRegion specifies the geographic region for Lambda Labs cloud
        deployments.
    v1ModelStatus:
      type: string
      enum:
        - MODEL_STATUS_UNSPECIFIED
        - MODEL_STATUS_INIT
        - MODEL_STATUS_UP
        - MODEL_STATUS_FAILED
        - MODEL_STATUS_DELETED
      default: MODEL_STATUS_UNSPECIFIED
    v1ModelEvent:
      type: object
      properties:
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the event occurred.
        log:
          type: string
          description: Log message associated with the event.
        eventType:
          $ref: '#/components/schemas/v1EventType'
      description: ModelEvent represents a single event in the model lifecycle.
    v1EventType:
      type: string
      enum:
        - EVENT_TYPE_UNSPECIFIED
        - EVENT_TYPE_ERROR
        - EVENT_TYPE_INFO
      default: EVENT_TYPE_UNSPECIFIED
      description: |-
        EventType categorizes model events.

         - EVENT_TYPE_UNSPECIFIED: Unspecified event type.
         - EVENT_TYPE_ERROR: Error event.
         - EVENT_TYPE_INFO: Informational event.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer authentication using an access token. Format: Bearer
        <access_token>

````