- API-Referenz
- AI hosting
- Get ai hosting plan and usages of a customer by planId
Get ai hosting plan and usages of a customer by planId
Request
- customerIdstringrequired
- planIdstringrequired
- topUsageCountinteger
Responses
The customer usage and plan.
- customerIdstringrequired
- deletedAtstring (date-time)
- descriptionstringrequired
- keysobjectrequired
- availableinteger (≥ -1)required
- planLimitinteger (≥ -1)required
- usedinteger (≥ 0)required
- modelTermsApprovalRequiredbooleanrequired
- nextTokenResetstring (date-time)required
- planIdstringrequired
- rateLimitobjectrequired
The number of allowed requests per unit. Limits are shared across all keys within the same project.
- allowedRequestsPerUnitintegerrequired
- unit"minute"required
- suspendedboolean
- tokensobjectrequired
- availableinteger (≥ -1, int64)required
- planLimitinteger (≥ -1, int64)required
- usedinteger (≥ 0, int64)required
- topUsagesArray von object
- Array[
- *object
- keyIdstring
- namestringrequired
- projectIdstring
- tokenUsedinteger (int64)required
]
Content-Type: application/json
{
"customerId": "string",
"deletedAt": "1985-10-26T01:21:00.000Z",
"description": "string",
"keys": {
"available": 123,
"planLimit": 123,
"used": 123
},
"modelTermsApprovalRequired": true,
"nextTokenReset": "1985-10-26T01:21:00.000Z",
"planId": "string",
"rateLimit": {
"allowedRequestsPerUnit": 123,
"unit": "minute"
},
"suspended": true,
"tokens": {
"available": 123,
"planLimit": 123,
"used": 123
},
"topUsages": [
{
"keyId": "string",
"name": "string",
"projectId": "string",
"tokenUsed": 123
}
]
}
{
"properties": {
"customerId": {
"type": "string"
},
"deletedAt": {
"format": "date-time",
"type": "string"
},
"description": {
"type": "string"
},
"keys": {
"properties": {
"available": {
"minimum": -1,
"type": "integer"
},
"planLimit": {
"minimum": -1,
"type": "integer"
},
"used": {
"minimum": 0,
"type": "integer"
}
},
"required": [
"used",
"available",
"planLimit"
],
"type": "object"
},
"modelTermsApprovalRequired": {
"default": false,
"type": "boolean"
},
"nextTokenReset": {
"format": "date-time",
"type": "string"
},
"planId": {
"type": "string"
},
"rateLimit": {
"description": "The number of allowed requests per unit. Limits are shared across all keys within the same project.",
"properties": {
"allowedRequestsPerUnit": {
"type": "integer"
},
"unit": {
"enum": [
"minute"
],
"type": "string"
}
},
"required": [
"allowedRequestsPerUnit",
"unit"
],
"type": "object"
},
"suspended": {
"default": false,
"type": "boolean"
},
"tokens": {
"properties": {
"available": {
"format": "int64",
"minimum": -1,
"type": "integer"
},
"planLimit": {
"format": "int64",
"minimum": -1,
"type": "integer"
},
"used": {
"format": "int64",
"minimum": 0,
"type": "integer"
}
},
"required": [
"used",
"available",
"planLimit"
],
"type": "object"
},
"topUsages": {
"items": {
"properties": {
"keyId": {
"type": "string"
},
"name": {
"type": "string"
},
"projectId": {
"type": "string"
},
"tokenUsed": {
"format": "int64",
"type": "integer"
}
},
"required": [
"name",
"tokenUsed"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"customerId",
"planId",
"description",
"keys",
"tokens",
"rateLimit",
"nextTokenReset",
"modelTermsApprovalRequired"
],
"type": "object"
}
Validation Error caused by invalid input data in the request
- type"ValidationError"required
- messagestring
- validationErrorsArray von objectrequired
- Array[
- *object
- messagestringrequired
The standard error message
- pathstringrequired
The path to the part of the data that was validated. JavaScript property access notation (e.g., ".prop[1].subProp") is used.
- typestringrequired
ajv validation error type (e.g. "format", "required", "type") or own validation error types
- contextobject
The object with the additional information about the error that can be used to create custom error messages. Keys depend on the type that failed validation (e.g. "missingProperty" for type "required")
- *string
]
Content-Type: application/json
{
"type": "ValidationError",
"message": "Validation failed",
"validationErrors": [
{
"message": "should be string",
"path": ".address.street",
"type": "format",
"context": {
"format": "email"
}
}
]
}
{
"type": "object",
"required": [
"type",
"validationErrors"
],
"properties": {
"type": {
"type": "string",
"enum": [
"ValidationError"
]
},
"message": {
"type": "string",
"example": "Validation failed"
},
"validationErrors": {
"type": "array",
"items": {
"type": "object",
"required": [
"message",
"path",
"type"
],
"properties": {
"message": {
"type": "string",
"description": "The standard error message",
"example": "should be string"
},
"path": {
"type": "string",
"description": "The path to the part of the data that was validated. JavaScript property access notation (e.g., \".prop[1].subProp\") is used.\n",
"example": ".address.street"
},
"type": {
"type": "string",
"description": "ajv validation error type (e.g. \"format\", \"required\", \"type\") or own validation error types",
"example": "format"
},
"context": {
"type": "object",
"example": {
"format": "email"
},
"description": "The object with the additional information about the error that can be used to create custom error messages. Keys depend on the\ntype that failed validation (e.g. \"missingProperty\" for type \"required\")\n",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
The requested resource was not found
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Your request ran into a rate limit. You have to wait until rate limit expires
- messagestring
- typestring
Content-Type: application/json
{
"message": "too many requests",
"type": "RateLimitError"
}
{
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "too many requests"
},
"type": {
"type": "string",
"example": "RateLimitError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Nutzungsbeispiele
$ curl \
--fail \
--location \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
https://api.mittwald.de/v2/customers/string/ai-hostings/string?topUsageCount=123
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";
const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.aiHosting.aiHostingCustomerGetPlan({
"customerId": "string",
"planId": "string",
"queryParameters": {
"topUsageCount": 123
}
});
assertStatus(response, 200);
use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingCustomerGetPlan\AiHostingCustomerGetPlanRequest;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
$request = (new AiHostingCustomerGetPlanRequest(
customerId: "string",
planId: "string"
))
->withTopUsageCount(123);
$response = $client->aiHosting()->aiHostingCustomerGetPlan($request);
var_dump($response->getBody();