CreateModelApi

Updated at:
Copy as MD

Creates a model API.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

GwClusterId

string

Yes

The gateway instance ID.

pg-xxxxxxxxxx

Name

string

Yes

The model API name.

test

ModelCategory

string

Yes

The model API category. Valid values:

  • text

  • embedding

  • rerank

text

PathPrefix

string

Yes

The path prefix.

/test

Protocol

string

Yes

The model API protocol. Valid values:

  • OpenAI

  • Anthropic

  • Model Studio

  • vLLM

openai

RecordInput

string

No

Specifies whether to record input for billing.

10

RecordOutput

string

No

Specifies whether to record output for billing.

10

RouteRules

string

Yes

A list of routing rules, provided as a JSON array string.

[ { "RuleName": "string", "FallbackMode": "failover", "MatchModelListJson": "[]", "providerBalancerAlgorithm": "round-robin", "Providers": [ { "ModelServiceName": "string", "Weight": "0", "model_protocol": "vllm" "ModelList": "[]" } ], "FallbackProviders": [ { "ModelServiceName": "string", "model_protocol": "anthropic", "Weight": "10", "ModelList": "[]" } ] } ]

ForceModel

string

No

The model to which requests are forcibly routed.

xxx

RegionId

string

No

The region ID.

cn-beijing

Response elements

Element

Type

Description

Example

object

The response data.

RequestId

string

The request ID.

6BD9CDE4-5E7B-4BF3-9BB8-83C73E******

ModelApiId

string

The model API ID.

mi-xxxxxx

InvokeEndpoint

string

The invocation endpoint.

xxx

Status

string

The model API status.

Enable

Examples

Success response

JSON format

{
  "RequestId": "6BD9CDE4-5E7B-4BF3-9BB8-83C73E******",
  "ModelApiId": "mi-xxxxxx",
  "InvokeEndpoint": "xxx",
  "Status": "Enable"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.