1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. apig
  6. AiModelProvider
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi

    Provides a APIG Ai Model Provider resource.

    AI Model Provider.

    For information about APIG Ai Model Provider and how to use it, see What is Ai Model Provider.

    NOTE: Available since v1.286.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    // The ID of an existing AI-type APIG gateway
    const gatewayId = config.require("gatewayId");
    const _default = new alicloud.apig.AiModelProvider("default", {
        gatewayId: gatewayId,
        modelProvider: "openai",
        displayName: name,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    # The ID of an existing AI-type APIG gateway
    gateway_id = config.require("gatewayId")
    default = alicloud.apig.AiModelProvider("default",
        gateway_id=gateway_id,
        model_provider="openai",
        display_name=name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apig"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		// The ID of an existing AI-type APIG gateway
    		gatewayId := cfg.Require("gatewayId")
    		_, err := apig.NewAiModelProvider(ctx, "default", &apig.AiModelProviderArgs{
    			GatewayId:     pulumi.String(gatewayId),
    			ModelProvider: pulumi.String("openai"),
    			DisplayName:   pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        // The ID of an existing AI-type APIG gateway
        var gatewayId = config.Require("gatewayId");
        var @default = new AliCloud.Apig.AiModelProvider("default", new()
        {
            GatewayId = gatewayId,
            ModelProvider = "openai",
            DisplayName = name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.apig.AiModelProvider;
    import com.pulumi.alicloud.apig.AiModelProviderArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var gatewayId = config.require("gatewayId");
            var default_ = new AiModelProvider("default", AiModelProviderArgs.builder()
                .gatewayId(gatewayId)
                .modelProvider("openai")
                .displayName(name)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
      # AiModelProvider must be bound to an existing AI-type APIG gateway.
      # Set the gateway_id variable to your own AI gateway.
      gatewayId:
        type: string
    resources:
      default:
        type: alicloud:apig:AiModelProvider
        properties:
          gatewayId: ${gatewayId}
          modelProvider: openai
          displayName: ${name}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    resource "alicloud_apig_aimodelprovider" "default" {
      gateway_id     = var.gatewayId
      model_provider = "openai"
      display_name   = var.name
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    # AiModelProvider must be bound to an existing AI-type APIG gateway.
    # Set the gateway_id variable to your own AI gateway.
    variable "gatewayId" {
      type        = string
      description = "The ID of an existing AI-type APIG gateway"
    }
    

    📚 Need more examples? VIEW MORE EXAMPLES

    Create AiModelProvider Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AiModelProvider(name: string, args: AiModelProviderArgs, opts?: CustomResourceOptions);
    @overload
    def AiModelProvider(resource_name: str,
                        args: AiModelProviderArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def AiModelProvider(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        display_name: Optional[str] = None,
                        gateway_id: Optional[str] = None,
                        model_provider: Optional[str] = None,
                        service_ids: Optional[Sequence[str]] = None)
    func NewAiModelProvider(ctx *Context, name string, args AiModelProviderArgs, opts ...ResourceOption) (*AiModelProvider, error)
    public AiModelProvider(string name, AiModelProviderArgs args, CustomResourceOptions? opts = null)
    public AiModelProvider(String name, AiModelProviderArgs args)
    public AiModelProvider(String name, AiModelProviderArgs args, CustomResourceOptions options)
    
    type: alicloud:apig:AiModelProvider
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_apig_ai_model_provider" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args AiModelProviderArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AiModelProviderArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AiModelProviderArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AiModelProviderArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AiModelProviderArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var aiModelProviderResource = new AliCloud.Apig.AiModelProvider("aiModelProviderResource", new()
    {
        DisplayName = "string",
        GatewayId = "string",
        ModelProvider = "string",
        ServiceIds = new[]
        {
            "string",
        },
    });
    
    example, err := apig.NewAiModelProvider(ctx, "aiModelProviderResource", &apig.AiModelProviderArgs{
    	DisplayName:   pulumi.String("string"),
    	GatewayId:     pulumi.String("string"),
    	ModelProvider: pulumi.String("string"),
    	ServiceIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    resource "alicloud_apig_ai_model_provider" "aiModelProviderResource" {
      lifecycle {
        create_before_destroy = true
      }
      display_name   = "string"
      gateway_id     = "string"
      model_provider = "string"
      service_ids    = ["string"]
    }
    
    var aiModelProviderResource = new AiModelProvider("aiModelProviderResource", AiModelProviderArgs.builder()
        .displayName("string")
        .gatewayId("string")
        .modelProvider("string")
        .serviceIds("string")
        .build());
    
    ai_model_provider_resource = alicloud.apig.AiModelProvider("aiModelProviderResource",
        display_name="string",
        gateway_id="string",
        model_provider="string",
        service_ids=["string"])
    
    const aiModelProviderResource = new alicloud.apig.AiModelProvider("aiModelProviderResource", {
        displayName: "string",
        gatewayId: "string",
        modelProvider: "string",
        serviceIds: ["string"],
    });
    
    type: alicloud:apig:AiModelProvider
    properties:
        displayName: string
        gatewayId: string
        modelProvider: string
        serviceIds:
            - string
    

    AiModelProvider Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The AiModelProvider resource accepts the following input properties:

    DisplayName string
    Model supplier presentation name. Required, no more than 128 characters in length.
    GatewayId string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    ModelProvider string
    Stable model vendor ID, no more than 128 characters in length.
    ServiceIds List<string>
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    DisplayName string
    Model supplier presentation name. Required, no more than 128 characters in length.
    GatewayId string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    ModelProvider string
    Stable model vendor ID, no more than 128 characters in length.
    ServiceIds []string
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    display_name string
    Model supplier presentation name. Required, no more than 128 characters in length.
    gateway_id string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    model_provider string
    Stable model vendor ID, no more than 128 characters in length.
    service_ids list(string)
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    displayName String
    Model supplier presentation name. Required, no more than 128 characters in length.
    gatewayId String
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    modelProvider String
    Stable model vendor ID, no more than 128 characters in length.
    serviceIds List<String>
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    displayName string
    Model supplier presentation name. Required, no more than 128 characters in length.
    gatewayId string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    modelProvider string
    Stable model vendor ID, no more than 128 characters in length.
    serviceIds string[]
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    display_name str
    Model supplier presentation name. Required, no more than 128 characters in length.
    gateway_id str
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    model_provider str
    Stable model vendor ID, no more than 128 characters in length.
    service_ids Sequence[str]
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    displayName String
    Model supplier presentation name. Required, no more than 128 characters in length.
    gatewayId String
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    modelProvider String
    Stable model vendor ID, no more than 128 characters in length.
    serviceIds List<String>
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AiModelProvider resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    ModelCount int
    The number of model cards currently associated with the model supplier.
    Source string
    Model supplier source.
    UpdateTime string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModelCount int
    The number of model cards currently associated with the model supplier.
    Source string
    Model supplier source.
    UpdateTime string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    id string
    The provider-assigned unique ID for this managed resource.
    model_count number
    The number of model cards currently associated with the model supplier.
    source string
    Model supplier source.
    update_time string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    id String
    The provider-assigned unique ID for this managed resource.
    modelCount Integer
    The number of model cards currently associated with the model supplier.
    source String
    Model supplier source.
    updateTime String
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    id string
    The provider-assigned unique ID for this managed resource.
    modelCount number
    The number of model cards currently associated with the model supplier.
    source string
    Model supplier source.
    updateTime string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    id str
    The provider-assigned unique ID for this managed resource.
    model_count int
    The number of model cards currently associated with the model supplier.
    source str
    Model supplier source.
    update_time str
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    id String
    The provider-assigned unique ID for this managed resource.
    modelCount Number
    The number of model cards currently associated with the model supplier.
    source String
    Model supplier source.
    updateTime String
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.

    Look up Existing AiModelProvider Resource

    Get an existing AiModelProvider resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: AiModelProviderState, opts?: CustomResourceOptions): AiModelProvider
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            display_name: Optional[str] = None,
            gateway_id: Optional[str] = None,
            model_count: Optional[int] = None,
            model_provider: Optional[str] = None,
            service_ids: Optional[Sequence[str]] = None,
            source: Optional[str] = None,
            update_time: Optional[str] = None) -> AiModelProvider
    func GetAiModelProvider(ctx *Context, name string, id IDInput, state *AiModelProviderState, opts ...ResourceOption) (*AiModelProvider, error)
    public static AiModelProvider Get(string name, Input<string> id, AiModelProviderState? state, CustomResourceOptions? opts = null)
    public static AiModelProvider get(String name, Output<String> id, AiModelProviderState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:apig:AiModelProvider    get:      id: ${id}
    import {
      to = alicloud_apig_ai_model_provider.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DisplayName string
    Model supplier presentation name. Required, no more than 128 characters in length.
    GatewayId string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    ModelCount int
    The number of model cards currently associated with the model supplier.
    ModelProvider string
    Stable model vendor ID, no more than 128 characters in length.
    ServiceIds List<string>
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    Source string
    Model supplier source.
    UpdateTime string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    DisplayName string
    Model supplier presentation name. Required, no more than 128 characters in length.
    GatewayId string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    ModelCount int
    The number of model cards currently associated with the model supplier.
    ModelProvider string
    Stable model vendor ID, no more than 128 characters in length.
    ServiceIds []string
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    Source string
    Model supplier source.
    UpdateTime string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    display_name string
    Model supplier presentation name. Required, no more than 128 characters in length.
    gateway_id string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    model_count number
    The number of model cards currently associated with the model supplier.
    model_provider string
    Stable model vendor ID, no more than 128 characters in length.
    service_ids list(string)
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    source string
    Model supplier source.
    update_time string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    displayName String
    Model supplier presentation name. Required, no more than 128 characters in length.
    gatewayId String
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    modelCount Integer
    The number of model cards currently associated with the model supplier.
    modelProvider String
    Stable model vendor ID, no more than 128 characters in length.
    serviceIds List<String>
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    source String
    Model supplier source.
    updateTime String
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    displayName string
    Model supplier presentation name. Required, no more than 128 characters in length.
    gatewayId string
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    modelCount number
    The number of model cards currently associated with the model supplier.
    modelProvider string
    Stable model vendor ID, no more than 128 characters in length.
    serviceIds string[]
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    source string
    Model supplier source.
    updateTime string
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    display_name str
    Model supplier presentation name. Required, no more than 128 characters in length.
    gateway_id str
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    model_count int
    The number of model cards currently associated with the model supplier.
    model_provider str
    Stable model vendor ID, no more than 128 characters in length.
    service_ids Sequence[str]
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    source str
    Model supplier source.
    update_time str
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.
    displayName String
    Model supplier presentation name. Required, no more than 128 characters in length.
    gatewayId String
    The ID of the AI gateway instance. The target instance must exist, belong to the current account, and be of the AI gateway type.
    modelCount Number
    The number of model cards currently associated with the model supplier.
    modelProvider String
    Stable model vendor ID, no more than 128 characters in length.
    serviceIds List<String>
    The full collection of AI service IDs to bind to the model vendor. If not passed, existing bindings are retained; if empty array, all bindings are cleared.
    source String
    Model supplier source.
    updateTime String
    The last update time of the model vendor, in the format of yyyy-MM-dd HH:mm:ss.

    Import

    APIG Ai Model Provider can be imported using the id, e.g.

    $ pulumi import alicloud:apig/aiModelProvider:AiModelProvider example <model_provider_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo alicloud logo
    Viewing docs for Alibaba Cloud v3.108.0
    published on Thursday, Sep 17, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial