# AI Gateway ## List Gateways `client.AIGateway.List(ctx, params) (*V4PagePaginationArray[AIGatewayListResponse], error)` **get** `/accounts/{account_id}/ai-gateway/gateways` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `params AIGatewayListParams` - `AccountID param.Field[string]` Path param - `Page param.Field[int64]` Query param - `PerPage param.Field[int64]` Query param - `Search param.Field[string]` Query param: Search by id ### Returns - `type AIGatewayListResponse struct{…}` - `ID string` gateway id - `CacheInvalidateOnUpdate bool` - `CacheTTL int64` - `CollectLogs bool` - `CreatedAt Time` - `ModifiedAt Time` - `RateLimitingInterval int64` - `RateLimitingLimit int64` - `Authentication bool` - `DLP AIGatewayListResponseDLP` - `type AIGatewayListResponseDLPObject struct{…}` - `Action AIGatewayListResponseDLPObjectAction` - `const AIGatewayListResponseDLPObjectActionBlock AIGatewayListResponseDLPObjectAction = "BLOCK"` - `const AIGatewayListResponseDLPObjectActionFlag AIGatewayListResponseDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayListResponseDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayListResponseDLPObjectPolicy` - `ID string` - `Action AIGatewayListResponseDLPObjectPoliciesAction` - `const AIGatewayListResponseDLPObjectPoliciesActionFlag AIGatewayListResponseDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayListResponseDLPObjectPoliciesActionBlock AIGatewayListResponseDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayListResponseDLPObjectPoliciesCheck` - `const AIGatewayListResponseDLPObjectPoliciesCheckRequest AIGatewayListResponseDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayListResponseDLPObjectPoliciesCheckResponse AIGatewayListResponseDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `IsDefault bool` - `LogManagement int64` - `LogManagementStrategy AIGatewayListResponseLogManagementStrategy` - `const AIGatewayListResponseLogManagementStrategyStopInserting AIGatewayListResponseLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayListResponseLogManagementStrategyDeleteOldest AIGatewayListResponseLogManagementStrategy = "DELETE_OLDEST"` - `Logpush bool` - `LogpushPublicKey string` - `Otel []AIGatewayListResponseOtel` - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayListResponseOtelContentType` - `const AIGatewayListResponseOtelContentTypeJson AIGatewayListResponseOtelContentType = "json"` - `const AIGatewayListResponseOtelContentTypeProtobuf AIGatewayListResponseOtelContentType = "protobuf"` - `RateLimitingTechnique AIGatewayListResponseRateLimitingTechnique` - `const AIGatewayListResponseRateLimitingTechniqueFixed AIGatewayListResponseRateLimitingTechnique = "fixed"` - `const AIGatewayListResponseRateLimitingTechniqueSliding AIGatewayListResponseRateLimitingTechnique = "sliding"` - `RetryBackoff AIGatewayListResponseRetryBackoff` Backoff strategy for retry delays - `const AIGatewayListResponseRetryBackoffConstant AIGatewayListResponseRetryBackoff = "constant"` - `const AIGatewayListResponseRetryBackoffLinear AIGatewayListResponseRetryBackoff = "linear"` - `const AIGatewayListResponseRetryBackoffExponential AIGatewayListResponseRetryBackoff = "exponential"` - `RetryDelay int64` Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts int64` Maximum number of retry attempts for failed requests (1-5) - `StoreID string` - `Stripe AIGatewayListResponseStripe` - `Authorization string` - `UsageEvents []AIGatewayListResponseStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode AIGatewayListResponseWorkersAIBillingMode` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayListResponseWorkersAIBillingModePostpaid AIGatewayListResponseWorkersAIBillingMode = "postpaid"` - `Zdr bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.AIGateway.List(context.TODO(), ai_gateway.AIGatewayListParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": [ { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true } ], "success": true } ``` ## Fetch a Gateway `client.AIGateway.Get(ctx, id, query) (*AIGatewayGetResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `id string` gateway id - `query AIGatewayGetParams` - `AccountID param.Field[string]` ### Returns - `type AIGatewayGetResponse struct{…}` - `ID string` gateway id - `CacheInvalidateOnUpdate bool` - `CacheTTL int64` - `CollectLogs bool` - `CreatedAt Time` - `ModifiedAt Time` - `RateLimitingInterval int64` - `RateLimitingLimit int64` - `Authentication bool` - `DLP AIGatewayGetResponseDLP` - `type AIGatewayGetResponseDLPObject struct{…}` - `Action AIGatewayGetResponseDLPObjectAction` - `const AIGatewayGetResponseDLPObjectActionBlock AIGatewayGetResponseDLPObjectAction = "BLOCK"` - `const AIGatewayGetResponseDLPObjectActionFlag AIGatewayGetResponseDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayGetResponseDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayGetResponseDLPObjectPolicy` - `ID string` - `Action AIGatewayGetResponseDLPObjectPoliciesAction` - `const AIGatewayGetResponseDLPObjectPoliciesActionFlag AIGatewayGetResponseDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayGetResponseDLPObjectPoliciesActionBlock AIGatewayGetResponseDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayGetResponseDLPObjectPoliciesCheck` - `const AIGatewayGetResponseDLPObjectPoliciesCheckRequest AIGatewayGetResponseDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayGetResponseDLPObjectPoliciesCheckResponse AIGatewayGetResponseDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `IsDefault bool` - `LogManagement int64` - `LogManagementStrategy AIGatewayGetResponseLogManagementStrategy` - `const AIGatewayGetResponseLogManagementStrategyStopInserting AIGatewayGetResponseLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayGetResponseLogManagementStrategyDeleteOldest AIGatewayGetResponseLogManagementStrategy = "DELETE_OLDEST"` - `Logpush bool` - `LogpushPublicKey string` - `Otel []AIGatewayGetResponseOtel` - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayGetResponseOtelContentType` - `const AIGatewayGetResponseOtelContentTypeJson AIGatewayGetResponseOtelContentType = "json"` - `const AIGatewayGetResponseOtelContentTypeProtobuf AIGatewayGetResponseOtelContentType = "protobuf"` - `RateLimitingTechnique AIGatewayGetResponseRateLimitingTechnique` - `const AIGatewayGetResponseRateLimitingTechniqueFixed AIGatewayGetResponseRateLimitingTechnique = "fixed"` - `const AIGatewayGetResponseRateLimitingTechniqueSliding AIGatewayGetResponseRateLimitingTechnique = "sliding"` - `RetryBackoff AIGatewayGetResponseRetryBackoff` Backoff strategy for retry delays - `const AIGatewayGetResponseRetryBackoffConstant AIGatewayGetResponseRetryBackoff = "constant"` - `const AIGatewayGetResponseRetryBackoffLinear AIGatewayGetResponseRetryBackoff = "linear"` - `const AIGatewayGetResponseRetryBackoffExponential AIGatewayGetResponseRetryBackoff = "exponential"` - `RetryDelay int64` Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts int64` Maximum number of retry attempts for failed requests (1-5) - `StoreID string` - `Stripe AIGatewayGetResponseStripe` - `Authorization string` - `UsageEvents []AIGatewayGetResponseStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode AIGatewayGetResponseWorkersAIBillingMode` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayGetResponseWorkersAIBillingModePostpaid AIGatewayGetResponseWorkersAIBillingMode = "postpaid"` - `Zdr bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) aiGateway, err := client.AIGateway.Get( context.TODO(), "my-gateway", ai_gateway.AIGatewayGetParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", aiGateway.ID) } ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` ## Create a new Gateway `client.AIGateway.New(ctx, params) (*AIGatewayNewResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways` Creates a new AI Gateway. ### Parameters - `params AIGatewayNewParams` - `AccountID param.Field[string]` Path param - `ID param.Field[string]` Body param: gateway id - `CacheInvalidateOnUpdate param.Field[bool]` Body param - `CacheTTL param.Field[int64]` Body param - `CollectLogs param.Field[bool]` Body param - `RateLimitingInterval param.Field[int64]` Body param - `RateLimitingLimit param.Field[int64]` Body param - `Authentication param.Field[bool]` Body param - `LogManagement param.Field[int64]` Body param - `LogManagementStrategy param.Field[AIGatewayNewParamsLogManagementStrategy]` Body param - `const AIGatewayNewParamsLogManagementStrategyStopInserting AIGatewayNewParamsLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayNewParamsLogManagementStrategyDeleteOldest AIGatewayNewParamsLogManagementStrategy = "DELETE_OLDEST"` - `Logpush param.Field[bool]` Body param - `LogpushPublicKey param.Field[string]` Body param - `RateLimitingTechnique param.Field[AIGatewayNewParamsRateLimitingTechnique]` Body param - `const AIGatewayNewParamsRateLimitingTechniqueFixed AIGatewayNewParamsRateLimitingTechnique = "fixed"` - `const AIGatewayNewParamsRateLimitingTechniqueSliding AIGatewayNewParamsRateLimitingTechnique = "sliding"` - `RetryBackoff param.Field[AIGatewayNewParamsRetryBackoff]` Body param: Backoff strategy for retry delays - `const AIGatewayNewParamsRetryBackoffConstant AIGatewayNewParamsRetryBackoff = "constant"` - `const AIGatewayNewParamsRetryBackoffLinear AIGatewayNewParamsRetryBackoff = "linear"` - `const AIGatewayNewParamsRetryBackoffExponential AIGatewayNewParamsRetryBackoff = "exponential"` - `RetryDelay param.Field[int64]` Body param: Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts param.Field[int64]` Body param: Maximum number of retry attempts for failed requests (1-5) - `WorkersAIBillingMode param.Field[AIGatewayNewParamsWorkersAIBillingMode]` Body param: Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayNewParamsWorkersAIBillingModePostpaid AIGatewayNewParamsWorkersAIBillingMode = "postpaid"` - `Zdr param.Field[bool]` Body param ### Returns - `type AIGatewayNewResponse struct{…}` - `ID string` gateway id - `CacheInvalidateOnUpdate bool` - `CacheTTL int64` - `CollectLogs bool` - `CreatedAt Time` - `ModifiedAt Time` - `RateLimitingInterval int64` - `RateLimitingLimit int64` - `Authentication bool` - `DLP AIGatewayNewResponseDLP` - `type AIGatewayNewResponseDLPObject struct{…}` - `Action AIGatewayNewResponseDLPObjectAction` - `const AIGatewayNewResponseDLPObjectActionBlock AIGatewayNewResponseDLPObjectAction = "BLOCK"` - `const AIGatewayNewResponseDLPObjectActionFlag AIGatewayNewResponseDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayNewResponseDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayNewResponseDLPObjectPolicy` - `ID string` - `Action AIGatewayNewResponseDLPObjectPoliciesAction` - `const AIGatewayNewResponseDLPObjectPoliciesActionFlag AIGatewayNewResponseDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayNewResponseDLPObjectPoliciesActionBlock AIGatewayNewResponseDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayNewResponseDLPObjectPoliciesCheck` - `const AIGatewayNewResponseDLPObjectPoliciesCheckRequest AIGatewayNewResponseDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayNewResponseDLPObjectPoliciesCheckResponse AIGatewayNewResponseDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `IsDefault bool` - `LogManagement int64` - `LogManagementStrategy AIGatewayNewResponseLogManagementStrategy` - `const AIGatewayNewResponseLogManagementStrategyStopInserting AIGatewayNewResponseLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayNewResponseLogManagementStrategyDeleteOldest AIGatewayNewResponseLogManagementStrategy = "DELETE_OLDEST"` - `Logpush bool` - `LogpushPublicKey string` - `Otel []AIGatewayNewResponseOtel` - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayNewResponseOtelContentType` - `const AIGatewayNewResponseOtelContentTypeJson AIGatewayNewResponseOtelContentType = "json"` - `const AIGatewayNewResponseOtelContentTypeProtobuf AIGatewayNewResponseOtelContentType = "protobuf"` - `RateLimitingTechnique AIGatewayNewResponseRateLimitingTechnique` - `const AIGatewayNewResponseRateLimitingTechniqueFixed AIGatewayNewResponseRateLimitingTechnique = "fixed"` - `const AIGatewayNewResponseRateLimitingTechniqueSliding AIGatewayNewResponseRateLimitingTechnique = "sliding"` - `RetryBackoff AIGatewayNewResponseRetryBackoff` Backoff strategy for retry delays - `const AIGatewayNewResponseRetryBackoffConstant AIGatewayNewResponseRetryBackoff = "constant"` - `const AIGatewayNewResponseRetryBackoffLinear AIGatewayNewResponseRetryBackoff = "linear"` - `const AIGatewayNewResponseRetryBackoffExponential AIGatewayNewResponseRetryBackoff = "exponential"` - `RetryDelay int64` Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts int64` Maximum number of retry attempts for failed requests (1-5) - `StoreID string` - `Stripe AIGatewayNewResponseStripe` - `Authorization string` - `UsageEvents []AIGatewayNewResponseStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode AIGatewayNewResponseWorkersAIBillingMode` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayNewResponseWorkersAIBillingModePostpaid AIGatewayNewResponseWorkersAIBillingMode = "postpaid"` - `Zdr bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) aiGateway, err := client.AIGateway.New(context.TODO(), ai_gateway.AIGatewayNewParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), ID: cloudflare.F("my-gateway"), CacheInvalidateOnUpdate: cloudflare.F(true), CacheTTL: cloudflare.F(int64(0)), CollectLogs: cloudflare.F(true), RateLimitingInterval: cloudflare.F(int64(0)), RateLimitingLimit: cloudflare.F(int64(0)), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", aiGateway.ID) } ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` ## Update a Gateway `client.AIGateway.Update(ctx, id, params) (*AIGatewayUpdateResponse, error)` **put** `/accounts/{account_id}/ai-gateway/gateways/{id}` Updates an existing AI Gateway dataset. ### Parameters - `id string` gateway id - `params AIGatewayUpdateParams` - `AccountID param.Field[string]` Path param - `CacheInvalidateOnUpdate param.Field[bool]` Body param - `CacheTTL param.Field[int64]` Body param - `CollectLogs param.Field[bool]` Body param - `RateLimitingInterval param.Field[int64]` Body param - `RateLimitingLimit param.Field[int64]` Body param - `Authentication param.Field[bool]` Body param - `DLP param.Field[AIGatewayUpdateParamsDLP]` Body param - `type AIGatewayUpdateParamsDLPObject struct{…}` - `Action AIGatewayUpdateParamsDLPObjectAction` - `const AIGatewayUpdateParamsDLPObjectActionBlock AIGatewayUpdateParamsDLPObjectAction = "BLOCK"` - `const AIGatewayUpdateParamsDLPObjectActionFlag AIGatewayUpdateParamsDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayUpdateParamsDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayUpdateParamsDLPObjectPolicy` - `ID string` - `Action AIGatewayUpdateParamsDLPObjectPoliciesAction` - `const AIGatewayUpdateParamsDLPObjectPoliciesActionFlag AIGatewayUpdateParamsDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayUpdateParamsDLPObjectPoliciesActionBlock AIGatewayUpdateParamsDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayUpdateParamsDLPObjectPoliciesCheck` - `const AIGatewayUpdateParamsDLPObjectPoliciesCheckRequest AIGatewayUpdateParamsDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayUpdateParamsDLPObjectPoliciesCheckResponse AIGatewayUpdateParamsDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `LogManagement param.Field[int64]` Body param - `LogManagementStrategy param.Field[AIGatewayUpdateParamsLogManagementStrategy]` Body param - `const AIGatewayUpdateParamsLogManagementStrategyStopInserting AIGatewayUpdateParamsLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayUpdateParamsLogManagementStrategyDeleteOldest AIGatewayUpdateParamsLogManagementStrategy = "DELETE_OLDEST"` - `Logpush param.Field[bool]` Body param - `LogpushPublicKey param.Field[string]` Body param - `Otel param.Field[[]AIGatewayUpdateParamsOtel]` Body param - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayUpdateParamsOtelContentType` - `const AIGatewayUpdateParamsOtelContentTypeJson AIGatewayUpdateParamsOtelContentType = "json"` - `const AIGatewayUpdateParamsOtelContentTypeProtobuf AIGatewayUpdateParamsOtelContentType = "protobuf"` - `RateLimitingTechnique param.Field[AIGatewayUpdateParamsRateLimitingTechnique]` Body param - `const AIGatewayUpdateParamsRateLimitingTechniqueFixed AIGatewayUpdateParamsRateLimitingTechnique = "fixed"` - `const AIGatewayUpdateParamsRateLimitingTechniqueSliding AIGatewayUpdateParamsRateLimitingTechnique = "sliding"` - `RetryBackoff param.Field[AIGatewayUpdateParamsRetryBackoff]` Body param: Backoff strategy for retry delays - `const AIGatewayUpdateParamsRetryBackoffConstant AIGatewayUpdateParamsRetryBackoff = "constant"` - `const AIGatewayUpdateParamsRetryBackoffLinear AIGatewayUpdateParamsRetryBackoff = "linear"` - `const AIGatewayUpdateParamsRetryBackoffExponential AIGatewayUpdateParamsRetryBackoff = "exponential"` - `RetryDelay param.Field[int64]` Body param: Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts param.Field[int64]` Body param: Maximum number of retry attempts for failed requests (1-5) - `StoreID param.Field[string]` Body param - `Stripe param.Field[AIGatewayUpdateParamsStripe]` Body param - `Authorization string` - `UsageEvents []AIGatewayUpdateParamsStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode param.Field[AIGatewayUpdateParamsWorkersAIBillingMode]` Body param: Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayUpdateParamsWorkersAIBillingModePostpaid AIGatewayUpdateParamsWorkersAIBillingMode = "postpaid"` - `Zdr param.Field[bool]` Body param ### Returns - `type AIGatewayUpdateResponse struct{…}` - `ID string` gateway id - `CacheInvalidateOnUpdate bool` - `CacheTTL int64` - `CollectLogs bool` - `CreatedAt Time` - `ModifiedAt Time` - `RateLimitingInterval int64` - `RateLimitingLimit int64` - `Authentication bool` - `DLP AIGatewayUpdateResponseDLP` - `type AIGatewayUpdateResponseDLPObject struct{…}` - `Action AIGatewayUpdateResponseDLPObjectAction` - `const AIGatewayUpdateResponseDLPObjectActionBlock AIGatewayUpdateResponseDLPObjectAction = "BLOCK"` - `const AIGatewayUpdateResponseDLPObjectActionFlag AIGatewayUpdateResponseDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayUpdateResponseDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayUpdateResponseDLPObjectPolicy` - `ID string` - `Action AIGatewayUpdateResponseDLPObjectPoliciesAction` - `const AIGatewayUpdateResponseDLPObjectPoliciesActionFlag AIGatewayUpdateResponseDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayUpdateResponseDLPObjectPoliciesActionBlock AIGatewayUpdateResponseDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayUpdateResponseDLPObjectPoliciesCheck` - `const AIGatewayUpdateResponseDLPObjectPoliciesCheckRequest AIGatewayUpdateResponseDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayUpdateResponseDLPObjectPoliciesCheckResponse AIGatewayUpdateResponseDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `IsDefault bool` - `LogManagement int64` - `LogManagementStrategy AIGatewayUpdateResponseLogManagementStrategy` - `const AIGatewayUpdateResponseLogManagementStrategyStopInserting AIGatewayUpdateResponseLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayUpdateResponseLogManagementStrategyDeleteOldest AIGatewayUpdateResponseLogManagementStrategy = "DELETE_OLDEST"` - `Logpush bool` - `LogpushPublicKey string` - `Otel []AIGatewayUpdateResponseOtel` - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayUpdateResponseOtelContentType` - `const AIGatewayUpdateResponseOtelContentTypeJson AIGatewayUpdateResponseOtelContentType = "json"` - `const AIGatewayUpdateResponseOtelContentTypeProtobuf AIGatewayUpdateResponseOtelContentType = "protobuf"` - `RateLimitingTechnique AIGatewayUpdateResponseRateLimitingTechnique` - `const AIGatewayUpdateResponseRateLimitingTechniqueFixed AIGatewayUpdateResponseRateLimitingTechnique = "fixed"` - `const AIGatewayUpdateResponseRateLimitingTechniqueSliding AIGatewayUpdateResponseRateLimitingTechnique = "sliding"` - `RetryBackoff AIGatewayUpdateResponseRetryBackoff` Backoff strategy for retry delays - `const AIGatewayUpdateResponseRetryBackoffConstant AIGatewayUpdateResponseRetryBackoff = "constant"` - `const AIGatewayUpdateResponseRetryBackoffLinear AIGatewayUpdateResponseRetryBackoff = "linear"` - `const AIGatewayUpdateResponseRetryBackoffExponential AIGatewayUpdateResponseRetryBackoff = "exponential"` - `RetryDelay int64` Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts int64` Maximum number of retry attempts for failed requests (1-5) - `StoreID string` - `Stripe AIGatewayUpdateResponseStripe` - `Authorization string` - `UsageEvents []AIGatewayUpdateResponseStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode AIGatewayUpdateResponseWorkersAIBillingMode` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayUpdateResponseWorkersAIBillingModePostpaid AIGatewayUpdateResponseWorkersAIBillingMode = "postpaid"` - `Zdr bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) aiGateway, err := client.AIGateway.Update( context.TODO(), "my-gateway", ai_gateway.AIGatewayUpdateParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), CacheInvalidateOnUpdate: cloudflare.F(true), CacheTTL: cloudflare.F(int64(0)), CollectLogs: cloudflare.F(true), RateLimitingInterval: cloudflare.F(int64(0)), RateLimitingLimit: cloudflare.F(int64(0)), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", aiGateway.ID) } ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` ## Delete a Gateway `client.AIGateway.Delete(ctx, id, body) (*AIGatewayDeleteResponse, error)` **delete** `/accounts/{account_id}/ai-gateway/gateways/{id}` Deletes an AI Gateway dataset. ### Parameters - `id string` gateway id - `body AIGatewayDeleteParams` - `AccountID param.Field[string]` ### Returns - `type AIGatewayDeleteResponse struct{…}` - `ID string` gateway id - `CacheInvalidateOnUpdate bool` - `CacheTTL int64` - `CollectLogs bool` - `CreatedAt Time` - `ModifiedAt Time` - `RateLimitingInterval int64` - `RateLimitingLimit int64` - `Authentication bool` - `DLP AIGatewayDeleteResponseDLP` - `type AIGatewayDeleteResponseDLPObject struct{…}` - `Action AIGatewayDeleteResponseDLPObjectAction` - `const AIGatewayDeleteResponseDLPObjectActionBlock AIGatewayDeleteResponseDLPObjectAction = "BLOCK"` - `const AIGatewayDeleteResponseDLPObjectActionFlag AIGatewayDeleteResponseDLPObjectAction = "FLAG"` - `Enabled bool` - `Profiles []string` - `type AIGatewayDeleteResponseDLPObject struct{…}` - `Enabled bool` - `Policies []AIGatewayDeleteResponseDLPObjectPolicy` - `ID string` - `Action AIGatewayDeleteResponseDLPObjectPoliciesAction` - `const AIGatewayDeleteResponseDLPObjectPoliciesActionFlag AIGatewayDeleteResponseDLPObjectPoliciesAction = "FLAG"` - `const AIGatewayDeleteResponseDLPObjectPoliciesActionBlock AIGatewayDeleteResponseDLPObjectPoliciesAction = "BLOCK"` - `Check []AIGatewayDeleteResponseDLPObjectPoliciesCheck` - `const AIGatewayDeleteResponseDLPObjectPoliciesCheckRequest AIGatewayDeleteResponseDLPObjectPoliciesCheck = "REQUEST"` - `const AIGatewayDeleteResponseDLPObjectPoliciesCheckResponse AIGatewayDeleteResponseDLPObjectPoliciesCheck = "RESPONSE"` - `Enabled bool` - `Profiles []string` - `IsDefault bool` - `LogManagement int64` - `LogManagementStrategy AIGatewayDeleteResponseLogManagementStrategy` - `const AIGatewayDeleteResponseLogManagementStrategyStopInserting AIGatewayDeleteResponseLogManagementStrategy = "STOP_INSERTING"` - `const AIGatewayDeleteResponseLogManagementStrategyDeleteOldest AIGatewayDeleteResponseLogManagementStrategy = "DELETE_OLDEST"` - `Logpush bool` - `LogpushPublicKey string` - `Otel []AIGatewayDeleteResponseOtel` - `Authorization string` - `Headers map[string, string]` - `URL string` - `ContentType AIGatewayDeleteResponseOtelContentType` - `const AIGatewayDeleteResponseOtelContentTypeJson AIGatewayDeleteResponseOtelContentType = "json"` - `const AIGatewayDeleteResponseOtelContentTypeProtobuf AIGatewayDeleteResponseOtelContentType = "protobuf"` - `RateLimitingTechnique AIGatewayDeleteResponseRateLimitingTechnique` - `const AIGatewayDeleteResponseRateLimitingTechniqueFixed AIGatewayDeleteResponseRateLimitingTechnique = "fixed"` - `const AIGatewayDeleteResponseRateLimitingTechniqueSliding AIGatewayDeleteResponseRateLimitingTechnique = "sliding"` - `RetryBackoff AIGatewayDeleteResponseRetryBackoff` Backoff strategy for retry delays - `const AIGatewayDeleteResponseRetryBackoffConstant AIGatewayDeleteResponseRetryBackoff = "constant"` - `const AIGatewayDeleteResponseRetryBackoffLinear AIGatewayDeleteResponseRetryBackoff = "linear"` - `const AIGatewayDeleteResponseRetryBackoffExponential AIGatewayDeleteResponseRetryBackoff = "exponential"` - `RetryDelay int64` Delay between retry attempts in milliseconds (0-5000) - `RetryMaxAttempts int64` Maximum number of retry attempts for failed requests (1-5) - `StoreID string` - `Stripe AIGatewayDeleteResponseStripe` - `Authorization string` - `UsageEvents []AIGatewayDeleteResponseStripeUsageEvent` - `Payload string` - `WorkersAIBillingMode AIGatewayDeleteResponseWorkersAIBillingMode` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `const AIGatewayDeleteResponseWorkersAIBillingModePostpaid AIGatewayDeleteResponseWorkersAIBillingMode = "postpaid"` - `Zdr bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) aiGateway, err := client.AIGateway.Delete( context.TODO(), "my-gateway", ai_gateway.AIGatewayDeleteParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", aiGateway.ID) } ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` # Evaluation Types ## List Evaluators `client.AIGateway.EvaluationTypes.List(ctx, params) (*V4PagePaginationArray[EvaluationTypeListResponse], error)` **get** `/accounts/{account_id}/ai-gateway/evaluation-types` List Evaluators ### Parameters - `params EvaluationTypeListParams` - `AccountID param.Field[string]` Path param - `OrderBy param.Field[string]` Query param - `OrderByDirection param.Field[EvaluationTypeListParamsOrderByDirection]` Query param - `const EvaluationTypeListParamsOrderByDirectionAsc EvaluationTypeListParamsOrderByDirection = "asc"` - `const EvaluationTypeListParamsOrderByDirectionDesc EvaluationTypeListParamsOrderByDirection = "desc"` - `Page param.Field[int64]` Query param - `PerPage param.Field[int64]` Query param ### Returns - `type EvaluationTypeListResponse struct{…}` - `ID string` - `CreatedAt Time` - `Description string` - `Enable bool` - `Mandatory bool` - `ModifiedAt Time` - `Name string` - `Type string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.AIGateway.EvaluationTypes.List(context.TODO(), ai_gateway.EvaluationTypeListParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "description": "description", "enable": true, "mandatory": true, "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "type": "type" } ], "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` # Logs ## List Gateway Logs `client.AIGateway.Logs.List(ctx, gatewayID, params) (*V4PagePaginationArray[LogListResponse], error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs` List Gateway Logs ### Parameters - `gatewayID string` gateway id - `params LogListParams` - `AccountID param.Field[string]` Path param - `Cached param.Field[bool]` Query param - `Direction param.Field[LogListParamsDirection]` Query param - `const LogListParamsDirectionAsc LogListParamsDirection = "asc"` - `const LogListParamsDirectionDesc LogListParamsDirection = "desc"` - `EndDate param.Field[Time]` Query param - `Feedback param.Field[LogListParamsFeedback]` Query param - `const LogListParamsFeedback0 LogListParamsFeedback = 0` - `const LogListParamsFeedback1 LogListParamsFeedback = 1` - `Filters param.Field[[]LogListParamsFilter]` Query param - `Key LogListParamsFiltersKey` - `const LogListParamsFiltersKeyID LogListParamsFiltersKey = "id"` - `const LogListParamsFiltersKeyCreatedAt LogListParamsFiltersKey = "created_at"` - `const LogListParamsFiltersKeyRequestContentType LogListParamsFiltersKey = "request_content_type"` - `const LogListParamsFiltersKeyResponseContentType LogListParamsFiltersKey = "response_content_type"` - `const LogListParamsFiltersKeyRequestType LogListParamsFiltersKey = "request_type"` - `const LogListParamsFiltersKeySuccess LogListParamsFiltersKey = "success"` - `const LogListParamsFiltersKeyCached LogListParamsFiltersKey = "cached"` - `const LogListParamsFiltersKeyProvider LogListParamsFiltersKey = "provider"` - `const LogListParamsFiltersKeyModel LogListParamsFiltersKey = "model"` - `const LogListParamsFiltersKeyModelType LogListParamsFiltersKey = "model_type"` - `const LogListParamsFiltersKeyCost LogListParamsFiltersKey = "cost"` - `const LogListParamsFiltersKeyTokens LogListParamsFiltersKey = "tokens"` - `const LogListParamsFiltersKeyTokensIn LogListParamsFiltersKey = "tokens_in"` - `const LogListParamsFiltersKeyTokensOut LogListParamsFiltersKey = "tokens_out"` - `const LogListParamsFiltersKeyDuration LogListParamsFiltersKey = "duration"` - `const LogListParamsFiltersKeyFeedback LogListParamsFiltersKey = "feedback"` - `const LogListParamsFiltersKeyEventID LogListParamsFiltersKey = "event_id"` - `const LogListParamsFiltersKeyMetadataKey LogListParamsFiltersKey = "metadata.key"` - `const LogListParamsFiltersKeyMetadataValue LogListParamsFiltersKey = "metadata.value"` - `const LogListParamsFiltersKeyAuthentication LogListParamsFiltersKey = "authentication"` - `const LogListParamsFiltersKeyWholesale LogListParamsFiltersKey = "wholesale"` - `const LogListParamsFiltersKeyCompatibilityMode LogListParamsFiltersKey = "compatibilityMode"` - `const LogListParamsFiltersKeyDLPAction LogListParamsFiltersKey = "dlp_action"` - `Operator LogListParamsFiltersOperator` - `const LogListParamsFiltersOperatorEq LogListParamsFiltersOperator = "eq"` - `const LogListParamsFiltersOperatorNeq LogListParamsFiltersOperator = "neq"` - `const LogListParamsFiltersOperatorContains LogListParamsFiltersOperator = "contains"` - `const LogListParamsFiltersOperatorLt LogListParamsFiltersOperator = "lt"` - `const LogListParamsFiltersOperatorGt LogListParamsFiltersOperator = "gt"` - `Value []LogListParamsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `MaxCost param.Field[float64]` Query param - `MaxDuration param.Field[float64]` Query param - `MaxTokensIn param.Field[float64]` Query param - `MaxTokensOut param.Field[float64]` Query param - `MaxTotalTokens param.Field[float64]` Query param - `MetaInfo param.Field[bool]` Query param - `MinCost param.Field[float64]` Query param - `MinDuration param.Field[float64]` Query param - `MinTokensIn param.Field[float64]` Query param - `MinTokensOut param.Field[float64]` Query param - `MinTotalTokens param.Field[float64]` Query param - `Model param.Field[string]` Query param - `ModelType param.Field[string]` Query param - `OrderBy param.Field[LogListParamsOrderBy]` Query param - `const LogListParamsOrderByCreatedAt LogListParamsOrderBy = "created_at"` - `const LogListParamsOrderByProvider LogListParamsOrderBy = "provider"` - `const LogListParamsOrderByModel LogListParamsOrderBy = "model"` - `const LogListParamsOrderByModelType LogListParamsOrderBy = "model_type"` - `const LogListParamsOrderBySuccess LogListParamsOrderBy = "success"` - `const LogListParamsOrderByCached LogListParamsOrderBy = "cached"` - `OrderByDirection param.Field[LogListParamsOrderByDirection]` Query param - `const LogListParamsOrderByDirectionAsc LogListParamsOrderByDirection = "asc"` - `const LogListParamsOrderByDirectionDesc LogListParamsOrderByDirection = "desc"` - `Page param.Field[int64]` Query param - `PerPage param.Field[int64]` Query param - `Provider param.Field[string]` Query param - `RequestContentType param.Field[string]` Query param - `ResponseContentType param.Field[string]` Query param - `Search param.Field[string]` Query param - `StartDate param.Field[Time]` Query param - `Success param.Field[bool]` Query param ### Returns - `type LogListResponse struct{…}` - `ID string` - `Cached bool` - `CreatedAt Time` - `Duration int64` - `Model string` - `Path string` - `Provider string` - `Success bool` - `TokensIn int64` - `TokensOut int64` - `Cost float64` - `CustomCost bool` - `Metadata string` - `ModelType string` - `RequestContentType string` - `RequestType string` - `ResponseContentType string` - `StatusCode int64` - `Step int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.AIGateway.Logs.List( context.TODO(), "my-gateway", ai_gateway.LogListParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": [ { "id": "id", "cached": true, "created_at": "2019-12-27T18:11:19.117Z", "duration": 0, "model": "model", "path": "path", "provider": "provider", "success": true, "tokens_in": 0, "tokens_out": 0, "cost": 0, "custom_cost": true, "metadata": "metadata", "model_type": "model_type", "request_content_type": "request_content_type", "request_type": "request_type", "response_content_type": "response_content_type", "status_code": 0, "step": 0 } ], "result_info": { "count": 0, "max_cost": 0, "max_duration": 0, "max_tokens_in": 0, "max_tokens_out": 0, "max_total_tokens": 0, "min_cost": 0, "min_duration": 0, "min_tokens_in": 0, "min_tokens_out": 0, "min_total_tokens": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` ## Get Gateway Log Detail `client.AIGateway.Logs.Get(ctx, gatewayID, id, query) (*LogGetResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}` Retrieves detailed information for a specific AI Gateway log entry. ### Parameters - `gatewayID string` gateway id - `id string` - `query LogGetParams` - `AccountID param.Field[string]` ### Returns - `type LogGetResponse struct{…}` - `ID string` - `Cached bool` - `CreatedAt Time` - `Duration int64` - `Model string` - `Path string` - `Provider string` - `Success bool` - `TokensIn int64` - `TokensOut int64` - `Cost float64` - `CustomCost bool` - `Metadata string` - `ModelType string` - `RequestContentType string` - `RequestHead string` - `RequestHeadComplete bool` - `RequestSize int64` - `RequestType string` - `ResponseContentType string` - `ResponseHead string` - `ResponseHeadComplete bool` - `ResponseSize int64` - `StatusCode int64` - `Step int64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) log, err := client.AIGateway.Logs.Get( context.TODO(), "my-gateway", "id", ai_gateway.LogGetParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", log.ID) } ``` #### Response ```json { "result": { "id": "id", "cached": true, "created_at": "2019-12-27T18:11:19.117Z", "duration": 0, "model": "model", "path": "path", "provider": "provider", "success": true, "tokens_in": 0, "tokens_out": 0, "cost": 0, "custom_cost": true, "metadata": "metadata", "model_type": "model_type", "request_content_type": "request_content_type", "request_head": "request_head", "request_head_complete": true, "request_size": 0, "request_type": "request_type", "response_content_type": "response_content_type", "response_head": "response_head", "response_head_complete": true, "response_size": 0, "status_code": 0, "step": 0 }, "success": true } ``` ## Patch Gateway Log `client.AIGateway.Logs.Edit(ctx, gatewayID, id, params) (*LogEditResponse, error)` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}` Updates metadata for an AI Gateway log entry. ### Parameters - `gatewayID string` gateway id - `id string` - `params LogEditParams` - `AccountID param.Field[string]` Path param - `Feedback param.Field[float64]` Body param - `Metadata param.Field[map[string, LogEditParamsMetadataUnion]]` Body param - `UnionString` - `UnionFloat` - `UnionBool` - `Score param.Field[float64]` Body param ### Returns - `type LogEditResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.Logs.Edit( context.TODO(), "my-gateway", "id", ai_gateway.LogEditParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "result": {}, "success": true } ``` ## Delete Gateway Logs `client.AIGateway.Logs.Delete(ctx, gatewayID, params) (*LogDeleteResponse, error)` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs` Delete Gateway Logs ### Parameters - `gatewayID string` gateway id - `params LogDeleteParams` - `AccountID param.Field[string]` Path param - `Filters param.Field[[]LogDeleteParamsFilter]` Query param - `Key LogDeleteParamsFiltersKey` - `const LogDeleteParamsFiltersKeyID LogDeleteParamsFiltersKey = "id"` - `const LogDeleteParamsFiltersKeyCreatedAt LogDeleteParamsFiltersKey = "created_at"` - `const LogDeleteParamsFiltersKeyRequestContentType LogDeleteParamsFiltersKey = "request_content_type"` - `const LogDeleteParamsFiltersKeyResponseContentType LogDeleteParamsFiltersKey = "response_content_type"` - `const LogDeleteParamsFiltersKeyRequestType LogDeleteParamsFiltersKey = "request_type"` - `const LogDeleteParamsFiltersKeySuccess LogDeleteParamsFiltersKey = "success"` - `const LogDeleteParamsFiltersKeyCached LogDeleteParamsFiltersKey = "cached"` - `const LogDeleteParamsFiltersKeyProvider LogDeleteParamsFiltersKey = "provider"` - `const LogDeleteParamsFiltersKeyModel LogDeleteParamsFiltersKey = "model"` - `const LogDeleteParamsFiltersKeyModelType LogDeleteParamsFiltersKey = "model_type"` - `const LogDeleteParamsFiltersKeyCost LogDeleteParamsFiltersKey = "cost"` - `const LogDeleteParamsFiltersKeyTokens LogDeleteParamsFiltersKey = "tokens"` - `const LogDeleteParamsFiltersKeyTokensIn LogDeleteParamsFiltersKey = "tokens_in"` - `const LogDeleteParamsFiltersKeyTokensOut LogDeleteParamsFiltersKey = "tokens_out"` - `const LogDeleteParamsFiltersKeyDuration LogDeleteParamsFiltersKey = "duration"` - `const LogDeleteParamsFiltersKeyFeedback LogDeleteParamsFiltersKey = "feedback"` - `const LogDeleteParamsFiltersKeyEventID LogDeleteParamsFiltersKey = "event_id"` - `const LogDeleteParamsFiltersKeyMetadataKey LogDeleteParamsFiltersKey = "metadata.key"` - `const LogDeleteParamsFiltersKeyMetadataValue LogDeleteParamsFiltersKey = "metadata.value"` - `const LogDeleteParamsFiltersKeyAuthentication LogDeleteParamsFiltersKey = "authentication"` - `const LogDeleteParamsFiltersKeyWholesale LogDeleteParamsFiltersKey = "wholesale"` - `const LogDeleteParamsFiltersKeyCompatibilityMode LogDeleteParamsFiltersKey = "compatibilityMode"` - `const LogDeleteParamsFiltersKeyDLPAction LogDeleteParamsFiltersKey = "dlp_action"` - `Operator LogDeleteParamsFiltersOperator` - `const LogDeleteParamsFiltersOperatorEq LogDeleteParamsFiltersOperator = "eq"` - `const LogDeleteParamsFiltersOperatorNeq LogDeleteParamsFiltersOperator = "neq"` - `const LogDeleteParamsFiltersOperatorContains LogDeleteParamsFiltersOperator = "contains"` - `const LogDeleteParamsFiltersOperatorLt LogDeleteParamsFiltersOperator = "lt"` - `const LogDeleteParamsFiltersOperatorGt LogDeleteParamsFiltersOperator = "gt"` - `Value []LogDeleteParamsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `Limit param.Field[int64]` Query param - `OrderBy param.Field[LogDeleteParamsOrderBy]` Query param - `const LogDeleteParamsOrderByCreatedAt LogDeleteParamsOrderBy = "created_at"` - `const LogDeleteParamsOrderByProvider LogDeleteParamsOrderBy = "provider"` - `const LogDeleteParamsOrderByModel LogDeleteParamsOrderBy = "model"` - `const LogDeleteParamsOrderByModelType LogDeleteParamsOrderBy = "model_type"` - `const LogDeleteParamsOrderBySuccess LogDeleteParamsOrderBy = "success"` - `const LogDeleteParamsOrderByCached LogDeleteParamsOrderBy = "cached"` - `const LogDeleteParamsOrderByCost LogDeleteParamsOrderBy = "cost"` - `const LogDeleteParamsOrderByTokensIn LogDeleteParamsOrderBy = "tokens_in"` - `const LogDeleteParamsOrderByTokensOut LogDeleteParamsOrderBy = "tokens_out"` - `const LogDeleteParamsOrderByDuration LogDeleteParamsOrderBy = "duration"` - `const LogDeleteParamsOrderByFeedback LogDeleteParamsOrderBy = "feedback"` - `OrderByDirection param.Field[LogDeleteParamsOrderByDirection]` Query param - `const LogDeleteParamsOrderByDirectionAsc LogDeleteParamsOrderByDirection = "asc"` - `const LogDeleteParamsOrderByDirectionDesc LogDeleteParamsOrderByDirection = "desc"` ### Returns - `type LogDeleteResponse struct{…}` - `Success bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) log, err := client.AIGateway.Logs.Delete( context.TODO(), "my-gateway", ai_gateway.LogDeleteParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", log.Success) } ``` #### Response ```json { "success": true } ``` ## Get Gateway Log Request `client.AIGateway.Logs.Request(ctx, gatewayID, id, query) (*LogRequestResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/request` Retrieves the original request payload for an AI Gateway log entry. ### Parameters - `gatewayID string` gateway id - `id string` - `query LogRequestParams` - `AccountID param.Field[string]` ### Returns - `type LogRequestResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.Logs.Request( context.TODO(), "my-gateway", "id", ai_gateway.LogRequestParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json {} ``` ## Get Gateway Log Response `client.AIGateway.Logs.Response(ctx, gatewayID, id, query) (*LogResponseResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/response` Retrieves the response payload for an AI Gateway log entry. ### Parameters - `gatewayID string` gateway id - `id string` - `query LogResponseParams` - `AccountID param.Field[string]` ### Returns - `type LogResponseResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.Logs.Response( context.TODO(), "my-gateway", "id", ai_gateway.LogResponseParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json {} ``` # Datasets ## List Datasets `client.AIGateway.Datasets.List(ctx, gatewayID, params) (*V4PagePaginationArray[DatasetListResponse], error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `gatewayID string` gateway id - `params DatasetListParams` - `AccountID param.Field[string]` Path param - `Enable param.Field[bool]` Query param - `Name param.Field[string]` Query param - `Page param.Field[int64]` Query param - `PerPage param.Field[int64]` Query param - `Search param.Field[string]` Query param: Search by id, name, filters ### Returns - `type DatasetListResponse struct{…}` - `ID string` - `CreatedAt Time` - `Enable bool` - `Filters []DatasetListResponseFilter` - `Key DatasetListResponseFiltersKey` - `const DatasetListResponseFiltersKeyCreatedAt DatasetListResponseFiltersKey = "created_at"` - `const DatasetListResponseFiltersKeyRequestContentType DatasetListResponseFiltersKey = "request_content_type"` - `const DatasetListResponseFiltersKeyResponseContentType DatasetListResponseFiltersKey = "response_content_type"` - `const DatasetListResponseFiltersKeySuccess DatasetListResponseFiltersKey = "success"` - `const DatasetListResponseFiltersKeyCached DatasetListResponseFiltersKey = "cached"` - `const DatasetListResponseFiltersKeyProvider DatasetListResponseFiltersKey = "provider"` - `const DatasetListResponseFiltersKeyModel DatasetListResponseFiltersKey = "model"` - `const DatasetListResponseFiltersKeyCost DatasetListResponseFiltersKey = "cost"` - `const DatasetListResponseFiltersKeyTokens DatasetListResponseFiltersKey = "tokens"` - `const DatasetListResponseFiltersKeyTokensIn DatasetListResponseFiltersKey = "tokens_in"` - `const DatasetListResponseFiltersKeyTokensOut DatasetListResponseFiltersKey = "tokens_out"` - `const DatasetListResponseFiltersKeyDuration DatasetListResponseFiltersKey = "duration"` - `const DatasetListResponseFiltersKeyFeedback DatasetListResponseFiltersKey = "feedback"` - `Operator DatasetListResponseFiltersOperator` - `const DatasetListResponseFiltersOperatorEq DatasetListResponseFiltersOperator = "eq"` - `const DatasetListResponseFiltersOperatorContains DatasetListResponseFiltersOperator = "contains"` - `const DatasetListResponseFiltersOperatorLt DatasetListResponseFiltersOperator = "lt"` - `const DatasetListResponseFiltersOperatorGt DatasetListResponseFiltersOperator = "gt"` - `Value []DatasetListResponseFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.AIGateway.Datasets.List( context.TODO(), "my-gateway", ai_gateway.DatasetListParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "success": true } ``` ## Fetch a Dataset `client.AIGateway.Datasets.Get(ctx, gatewayID, id, query) (*DatasetGetResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `gatewayID string` gateway id - `id string` - `query DatasetGetParams` - `AccountID param.Field[string]` ### Returns - `type DatasetGetResponse struct{…}` - `ID string` - `CreatedAt Time` - `Enable bool` - `Filters []DatasetGetResponseFilter` - `Key DatasetGetResponseFiltersKey` - `const DatasetGetResponseFiltersKeyCreatedAt DatasetGetResponseFiltersKey = "created_at"` - `const DatasetGetResponseFiltersKeyRequestContentType DatasetGetResponseFiltersKey = "request_content_type"` - `const DatasetGetResponseFiltersKeyResponseContentType DatasetGetResponseFiltersKey = "response_content_type"` - `const DatasetGetResponseFiltersKeySuccess DatasetGetResponseFiltersKey = "success"` - `const DatasetGetResponseFiltersKeyCached DatasetGetResponseFiltersKey = "cached"` - `const DatasetGetResponseFiltersKeyProvider DatasetGetResponseFiltersKey = "provider"` - `const DatasetGetResponseFiltersKeyModel DatasetGetResponseFiltersKey = "model"` - `const DatasetGetResponseFiltersKeyCost DatasetGetResponseFiltersKey = "cost"` - `const DatasetGetResponseFiltersKeyTokens DatasetGetResponseFiltersKey = "tokens"` - `const DatasetGetResponseFiltersKeyTokensIn DatasetGetResponseFiltersKey = "tokens_in"` - `const DatasetGetResponseFiltersKeyTokensOut DatasetGetResponseFiltersKey = "tokens_out"` - `const DatasetGetResponseFiltersKeyDuration DatasetGetResponseFiltersKey = "duration"` - `const DatasetGetResponseFiltersKeyFeedback DatasetGetResponseFiltersKey = "feedback"` - `Operator DatasetGetResponseFiltersOperator` - `const DatasetGetResponseFiltersOperatorEq DatasetGetResponseFiltersOperator = "eq"` - `const DatasetGetResponseFiltersOperatorContains DatasetGetResponseFiltersOperator = "contains"` - `const DatasetGetResponseFiltersOperatorLt DatasetGetResponseFiltersOperator = "lt"` - `const DatasetGetResponseFiltersOperatorGt DatasetGetResponseFiltersOperator = "gt"` - `Value []DatasetGetResponseFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dataset, err := client.AIGateway.Datasets.Get( context.TODO(), "my-gateway", "id", ai_gateway.DatasetGetParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dataset.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Create a new Dataset `client.AIGateway.Datasets.New(ctx, gatewayID, params) (*DatasetNewResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets` Creates a new AI Gateway. ### Parameters - `gatewayID string` gateway id - `params DatasetNewParams` - `AccountID param.Field[string]` Path param - `Enable param.Field[bool]` Body param - `Filters param.Field[[]DatasetNewParamsFilter]` Body param - `Key DatasetNewParamsFiltersKey` - `const DatasetNewParamsFiltersKeyCreatedAt DatasetNewParamsFiltersKey = "created_at"` - `const DatasetNewParamsFiltersKeyRequestContentType DatasetNewParamsFiltersKey = "request_content_type"` - `const DatasetNewParamsFiltersKeyResponseContentType DatasetNewParamsFiltersKey = "response_content_type"` - `const DatasetNewParamsFiltersKeySuccess DatasetNewParamsFiltersKey = "success"` - `const DatasetNewParamsFiltersKeyCached DatasetNewParamsFiltersKey = "cached"` - `const DatasetNewParamsFiltersKeyProvider DatasetNewParamsFiltersKey = "provider"` - `const DatasetNewParamsFiltersKeyModel DatasetNewParamsFiltersKey = "model"` - `const DatasetNewParamsFiltersKeyCost DatasetNewParamsFiltersKey = "cost"` - `const DatasetNewParamsFiltersKeyTokens DatasetNewParamsFiltersKey = "tokens"` - `const DatasetNewParamsFiltersKeyTokensIn DatasetNewParamsFiltersKey = "tokens_in"` - `const DatasetNewParamsFiltersKeyTokensOut DatasetNewParamsFiltersKey = "tokens_out"` - `const DatasetNewParamsFiltersKeyDuration DatasetNewParamsFiltersKey = "duration"` - `const DatasetNewParamsFiltersKeyFeedback DatasetNewParamsFiltersKey = "feedback"` - `Operator DatasetNewParamsFiltersOperator` - `const DatasetNewParamsFiltersOperatorEq DatasetNewParamsFiltersOperator = "eq"` - `const DatasetNewParamsFiltersOperatorContains DatasetNewParamsFiltersOperator = "contains"` - `const DatasetNewParamsFiltersOperatorLt DatasetNewParamsFiltersOperator = "lt"` - `const DatasetNewParamsFiltersOperatorGt DatasetNewParamsFiltersOperator = "gt"` - `Value []DatasetNewParamsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `Name param.Field[string]` Body param ### Returns - `type DatasetNewResponse struct{…}` - `ID string` - `CreatedAt Time` - `Enable bool` - `Filters []DatasetNewResponseFilter` - `Key DatasetNewResponseFiltersKey` - `const DatasetNewResponseFiltersKeyCreatedAt DatasetNewResponseFiltersKey = "created_at"` - `const DatasetNewResponseFiltersKeyRequestContentType DatasetNewResponseFiltersKey = "request_content_type"` - `const DatasetNewResponseFiltersKeyResponseContentType DatasetNewResponseFiltersKey = "response_content_type"` - `const DatasetNewResponseFiltersKeySuccess DatasetNewResponseFiltersKey = "success"` - `const DatasetNewResponseFiltersKeyCached DatasetNewResponseFiltersKey = "cached"` - `const DatasetNewResponseFiltersKeyProvider DatasetNewResponseFiltersKey = "provider"` - `const DatasetNewResponseFiltersKeyModel DatasetNewResponseFiltersKey = "model"` - `const DatasetNewResponseFiltersKeyCost DatasetNewResponseFiltersKey = "cost"` - `const DatasetNewResponseFiltersKeyTokens DatasetNewResponseFiltersKey = "tokens"` - `const DatasetNewResponseFiltersKeyTokensIn DatasetNewResponseFiltersKey = "tokens_in"` - `const DatasetNewResponseFiltersKeyTokensOut DatasetNewResponseFiltersKey = "tokens_out"` - `const DatasetNewResponseFiltersKeyDuration DatasetNewResponseFiltersKey = "duration"` - `const DatasetNewResponseFiltersKeyFeedback DatasetNewResponseFiltersKey = "feedback"` - `Operator DatasetNewResponseFiltersOperator` - `const DatasetNewResponseFiltersOperatorEq DatasetNewResponseFiltersOperator = "eq"` - `const DatasetNewResponseFiltersOperatorContains DatasetNewResponseFiltersOperator = "contains"` - `const DatasetNewResponseFiltersOperatorLt DatasetNewResponseFiltersOperator = "lt"` - `const DatasetNewResponseFiltersOperatorGt DatasetNewResponseFiltersOperator = "gt"` - `Value []DatasetNewResponseFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/shared" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dataset, err := client.AIGateway.Datasets.New( context.TODO(), "my-gateway", ai_gateway.DatasetNewParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), Enable: cloudflare.F(true), Filters: cloudflare.F([]ai_gateway.DatasetNewParamsFilter{ai_gateway.DatasetNewParamsFilter{ Key: cloudflare.F(ai_gateway.DatasetNewParamsFiltersKeyCreatedAt), Operator: cloudflare.F(ai_gateway.DatasetNewParamsFiltersOperatorEq), Value: cloudflare.F([]ai_gateway.DatasetNewParamsFiltersValueUnion{shared.UnionString("string")}), }}), Name: cloudflare.F("name"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dataset.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Update a Dataset `client.AIGateway.Datasets.Update(ctx, gatewayID, id, params) (*DatasetUpdateResponse, error)` **put** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Updates an existing AI Gateway dataset. ### Parameters - `gatewayID string` gateway id - `id string` - `params DatasetUpdateParams` - `AccountID param.Field[string]` Path param - `Enable param.Field[bool]` Body param - `Filters param.Field[[]DatasetUpdateParamsFilter]` Body param - `Key DatasetUpdateParamsFiltersKey` - `const DatasetUpdateParamsFiltersKeyCreatedAt DatasetUpdateParamsFiltersKey = "created_at"` - `const DatasetUpdateParamsFiltersKeyRequestContentType DatasetUpdateParamsFiltersKey = "request_content_type"` - `const DatasetUpdateParamsFiltersKeyResponseContentType DatasetUpdateParamsFiltersKey = "response_content_type"` - `const DatasetUpdateParamsFiltersKeySuccess DatasetUpdateParamsFiltersKey = "success"` - `const DatasetUpdateParamsFiltersKeyCached DatasetUpdateParamsFiltersKey = "cached"` - `const DatasetUpdateParamsFiltersKeyProvider DatasetUpdateParamsFiltersKey = "provider"` - `const DatasetUpdateParamsFiltersKeyModel DatasetUpdateParamsFiltersKey = "model"` - `const DatasetUpdateParamsFiltersKeyCost DatasetUpdateParamsFiltersKey = "cost"` - `const DatasetUpdateParamsFiltersKeyTokens DatasetUpdateParamsFiltersKey = "tokens"` - `const DatasetUpdateParamsFiltersKeyTokensIn DatasetUpdateParamsFiltersKey = "tokens_in"` - `const DatasetUpdateParamsFiltersKeyTokensOut DatasetUpdateParamsFiltersKey = "tokens_out"` - `const DatasetUpdateParamsFiltersKeyDuration DatasetUpdateParamsFiltersKey = "duration"` - `const DatasetUpdateParamsFiltersKeyFeedback DatasetUpdateParamsFiltersKey = "feedback"` - `Operator DatasetUpdateParamsFiltersOperator` - `const DatasetUpdateParamsFiltersOperatorEq DatasetUpdateParamsFiltersOperator = "eq"` - `const DatasetUpdateParamsFiltersOperatorContains DatasetUpdateParamsFiltersOperator = "contains"` - `const DatasetUpdateParamsFiltersOperatorLt DatasetUpdateParamsFiltersOperator = "lt"` - `const DatasetUpdateParamsFiltersOperatorGt DatasetUpdateParamsFiltersOperator = "gt"` - `Value []DatasetUpdateParamsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `Name param.Field[string]` Body param ### Returns - `type DatasetUpdateResponse struct{…}` - `ID string` - `CreatedAt Time` - `Enable bool` - `Filters []DatasetUpdateResponseFilter` - `Key DatasetUpdateResponseFiltersKey` - `const DatasetUpdateResponseFiltersKeyCreatedAt DatasetUpdateResponseFiltersKey = "created_at"` - `const DatasetUpdateResponseFiltersKeyRequestContentType DatasetUpdateResponseFiltersKey = "request_content_type"` - `const DatasetUpdateResponseFiltersKeyResponseContentType DatasetUpdateResponseFiltersKey = "response_content_type"` - `const DatasetUpdateResponseFiltersKeySuccess DatasetUpdateResponseFiltersKey = "success"` - `const DatasetUpdateResponseFiltersKeyCached DatasetUpdateResponseFiltersKey = "cached"` - `const DatasetUpdateResponseFiltersKeyProvider DatasetUpdateResponseFiltersKey = "provider"` - `const DatasetUpdateResponseFiltersKeyModel DatasetUpdateResponseFiltersKey = "model"` - `const DatasetUpdateResponseFiltersKeyCost DatasetUpdateResponseFiltersKey = "cost"` - `const DatasetUpdateResponseFiltersKeyTokens DatasetUpdateResponseFiltersKey = "tokens"` - `const DatasetUpdateResponseFiltersKeyTokensIn DatasetUpdateResponseFiltersKey = "tokens_in"` - `const DatasetUpdateResponseFiltersKeyTokensOut DatasetUpdateResponseFiltersKey = "tokens_out"` - `const DatasetUpdateResponseFiltersKeyDuration DatasetUpdateResponseFiltersKey = "duration"` - `const DatasetUpdateResponseFiltersKeyFeedback DatasetUpdateResponseFiltersKey = "feedback"` - `Operator DatasetUpdateResponseFiltersOperator` - `const DatasetUpdateResponseFiltersOperatorEq DatasetUpdateResponseFiltersOperator = "eq"` - `const DatasetUpdateResponseFiltersOperatorContains DatasetUpdateResponseFiltersOperator = "contains"` - `const DatasetUpdateResponseFiltersOperatorLt DatasetUpdateResponseFiltersOperator = "lt"` - `const DatasetUpdateResponseFiltersOperatorGt DatasetUpdateResponseFiltersOperator = "gt"` - `Value []DatasetUpdateResponseFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/shared" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dataset, err := client.AIGateway.Datasets.Update( context.TODO(), "my-gateway", "id", ai_gateway.DatasetUpdateParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), Enable: cloudflare.F(true), Filters: cloudflare.F([]ai_gateway.DatasetUpdateParamsFilter{ai_gateway.DatasetUpdateParamsFilter{ Key: cloudflare.F(ai_gateway.DatasetUpdateParamsFiltersKeyCreatedAt), Operator: cloudflare.F(ai_gateway.DatasetUpdateParamsFiltersOperatorEq), Value: cloudflare.F([]ai_gateway.DatasetUpdateParamsFiltersValueUnion{shared.UnionString("string")}), }}), Name: cloudflare.F("name"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dataset.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Delete a Dataset `client.AIGateway.Datasets.Delete(ctx, gatewayID, id, body) (*DatasetDeleteResponse, error)` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Deletes an AI Gateway dataset. ### Parameters - `gatewayID string` gateway id - `id string` - `body DatasetDeleteParams` - `AccountID param.Field[string]` ### Returns - `type DatasetDeleteResponse struct{…}` - `ID string` - `CreatedAt Time` - `Enable bool` - `Filters []DatasetDeleteResponseFilter` - `Key DatasetDeleteResponseFiltersKey` - `const DatasetDeleteResponseFiltersKeyCreatedAt DatasetDeleteResponseFiltersKey = "created_at"` - `const DatasetDeleteResponseFiltersKeyRequestContentType DatasetDeleteResponseFiltersKey = "request_content_type"` - `const DatasetDeleteResponseFiltersKeyResponseContentType DatasetDeleteResponseFiltersKey = "response_content_type"` - `const DatasetDeleteResponseFiltersKeySuccess DatasetDeleteResponseFiltersKey = "success"` - `const DatasetDeleteResponseFiltersKeyCached DatasetDeleteResponseFiltersKey = "cached"` - `const DatasetDeleteResponseFiltersKeyProvider DatasetDeleteResponseFiltersKey = "provider"` - `const DatasetDeleteResponseFiltersKeyModel DatasetDeleteResponseFiltersKey = "model"` - `const DatasetDeleteResponseFiltersKeyCost DatasetDeleteResponseFiltersKey = "cost"` - `const DatasetDeleteResponseFiltersKeyTokens DatasetDeleteResponseFiltersKey = "tokens"` - `const DatasetDeleteResponseFiltersKeyTokensIn DatasetDeleteResponseFiltersKey = "tokens_in"` - `const DatasetDeleteResponseFiltersKeyTokensOut DatasetDeleteResponseFiltersKey = "tokens_out"` - `const DatasetDeleteResponseFiltersKeyDuration DatasetDeleteResponseFiltersKey = "duration"` - `const DatasetDeleteResponseFiltersKeyFeedback DatasetDeleteResponseFiltersKey = "feedback"` - `Operator DatasetDeleteResponseFiltersOperator` - `const DatasetDeleteResponseFiltersOperatorEq DatasetDeleteResponseFiltersOperator = "eq"` - `const DatasetDeleteResponseFiltersOperatorContains DatasetDeleteResponseFiltersOperator = "contains"` - `const DatasetDeleteResponseFiltersOperatorLt DatasetDeleteResponseFiltersOperator = "lt"` - `const DatasetDeleteResponseFiltersOperatorGt DatasetDeleteResponseFiltersOperator = "gt"` - `Value []DatasetDeleteResponseFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dataset, err := client.AIGateway.Datasets.Delete( context.TODO(), "my-gateway", "id", ai_gateway.DatasetDeleteParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dataset.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` # Evaluations ## List Evaluations `client.AIGateway.Evaluations.List(ctx, gatewayID, params) (*V4PagePaginationArray[EvaluationListResponse], error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `gatewayID string` gateway id - `params EvaluationListParams` - `AccountID param.Field[string]` Path param - `Name param.Field[string]` Query param - `Page param.Field[int64]` Query param - `PerPage param.Field[int64]` Query param - `Processed param.Field[bool]` Query param - `Search param.Field[string]` Query param: Search by id, name ### Returns - `type EvaluationListResponse struct{…}` - `ID string` - `CreatedAt Time` - `Datasets []EvaluationListResponseDataset` - `ID string` - `AccountID string` - `AccountTag string` - `CreatedAt Time` - `Enable bool` - `Filters []EvaluationListResponseDatasetsFilter` - `Key EvaluationListResponseDatasetsFiltersKey` - `const EvaluationListResponseDatasetsFiltersKeyCreatedAt EvaluationListResponseDatasetsFiltersKey = "created_at"` - `const EvaluationListResponseDatasetsFiltersKeyRequestContentType EvaluationListResponseDatasetsFiltersKey = "request_content_type"` - `const EvaluationListResponseDatasetsFiltersKeyResponseContentType EvaluationListResponseDatasetsFiltersKey = "response_content_type"` - `const EvaluationListResponseDatasetsFiltersKeySuccess EvaluationListResponseDatasetsFiltersKey = "success"` - `const EvaluationListResponseDatasetsFiltersKeyCached EvaluationListResponseDatasetsFiltersKey = "cached"` - `const EvaluationListResponseDatasetsFiltersKeyProvider EvaluationListResponseDatasetsFiltersKey = "provider"` - `const EvaluationListResponseDatasetsFiltersKeyModel EvaluationListResponseDatasetsFiltersKey = "model"` - `const EvaluationListResponseDatasetsFiltersKeyCost EvaluationListResponseDatasetsFiltersKey = "cost"` - `const EvaluationListResponseDatasetsFiltersKeyTokens EvaluationListResponseDatasetsFiltersKey = "tokens"` - `const EvaluationListResponseDatasetsFiltersKeyTokensIn EvaluationListResponseDatasetsFiltersKey = "tokens_in"` - `const EvaluationListResponseDatasetsFiltersKeyTokensOut EvaluationListResponseDatasetsFiltersKey = "tokens_out"` - `const EvaluationListResponseDatasetsFiltersKeyDuration EvaluationListResponseDatasetsFiltersKey = "duration"` - `const EvaluationListResponseDatasetsFiltersKeyFeedback EvaluationListResponseDatasetsFiltersKey = "feedback"` - `Operator EvaluationListResponseDatasetsFiltersOperator` - `const EvaluationListResponseDatasetsFiltersOperatorEq EvaluationListResponseDatasetsFiltersOperator = "eq"` - `const EvaluationListResponseDatasetsFiltersOperatorContains EvaluationListResponseDatasetsFiltersOperator = "contains"` - `const EvaluationListResponseDatasetsFiltersOperatorLt EvaluationListResponseDatasetsFiltersOperator = "lt"` - `const EvaluationListResponseDatasetsFiltersOperatorGt EvaluationListResponseDatasetsFiltersOperator = "gt"` - `Value []EvaluationListResponseDatasetsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `Processed bool` - `Results []EvaluationListResponseResult` - `ID string` - `CreatedAt Time` - `EvaluationID string` - `EvaluationTypeID string` - `ModifiedAt Time` - `Result string` - `Status float64` - `StatusDescription string` - `TotalLogs float64` - `TotalLogs float64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.AIGateway.Evaluations.List( context.TODO(), "my-gateway", ai_gateway.EvaluationListParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 } ], "success": true } ``` ## Fetch a Evaluation `client.AIGateway.Evaluations.Get(ctx, gatewayID, id, query) (*EvaluationGetResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `gatewayID string` gateway id - `id string` - `query EvaluationGetParams` - `AccountID param.Field[string]` ### Returns - `type EvaluationGetResponse struct{…}` - `ID string` - `CreatedAt Time` - `Datasets []EvaluationGetResponseDataset` - `ID string` - `AccountID string` - `AccountTag string` - `CreatedAt Time` - `Enable bool` - `Filters []EvaluationGetResponseDatasetsFilter` - `Key EvaluationGetResponseDatasetsFiltersKey` - `const EvaluationGetResponseDatasetsFiltersKeyCreatedAt EvaluationGetResponseDatasetsFiltersKey = "created_at"` - `const EvaluationGetResponseDatasetsFiltersKeyRequestContentType EvaluationGetResponseDatasetsFiltersKey = "request_content_type"` - `const EvaluationGetResponseDatasetsFiltersKeyResponseContentType EvaluationGetResponseDatasetsFiltersKey = "response_content_type"` - `const EvaluationGetResponseDatasetsFiltersKeySuccess EvaluationGetResponseDatasetsFiltersKey = "success"` - `const EvaluationGetResponseDatasetsFiltersKeyCached EvaluationGetResponseDatasetsFiltersKey = "cached"` - `const EvaluationGetResponseDatasetsFiltersKeyProvider EvaluationGetResponseDatasetsFiltersKey = "provider"` - `const EvaluationGetResponseDatasetsFiltersKeyModel EvaluationGetResponseDatasetsFiltersKey = "model"` - `const EvaluationGetResponseDatasetsFiltersKeyCost EvaluationGetResponseDatasetsFiltersKey = "cost"` - `const EvaluationGetResponseDatasetsFiltersKeyTokens EvaluationGetResponseDatasetsFiltersKey = "tokens"` - `const EvaluationGetResponseDatasetsFiltersKeyTokensIn EvaluationGetResponseDatasetsFiltersKey = "tokens_in"` - `const EvaluationGetResponseDatasetsFiltersKeyTokensOut EvaluationGetResponseDatasetsFiltersKey = "tokens_out"` - `const EvaluationGetResponseDatasetsFiltersKeyDuration EvaluationGetResponseDatasetsFiltersKey = "duration"` - `const EvaluationGetResponseDatasetsFiltersKeyFeedback EvaluationGetResponseDatasetsFiltersKey = "feedback"` - `Operator EvaluationGetResponseDatasetsFiltersOperator` - `const EvaluationGetResponseDatasetsFiltersOperatorEq EvaluationGetResponseDatasetsFiltersOperator = "eq"` - `const EvaluationGetResponseDatasetsFiltersOperatorContains EvaluationGetResponseDatasetsFiltersOperator = "contains"` - `const EvaluationGetResponseDatasetsFiltersOperatorLt EvaluationGetResponseDatasetsFiltersOperator = "lt"` - `const EvaluationGetResponseDatasetsFiltersOperatorGt EvaluationGetResponseDatasetsFiltersOperator = "gt"` - `Value []EvaluationGetResponseDatasetsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `Processed bool` - `Results []EvaluationGetResponseResult` - `ID string` - `CreatedAt Time` - `EvaluationID string` - `EvaluationTypeID string` - `ModifiedAt Time` - `Result string` - `Status float64` - `StatusDescription string` - `TotalLogs float64` - `TotalLogs float64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) evaluation, err := client.AIGateway.Evaluations.Get( context.TODO(), "my-gateway", "id", ai_gateway.EvaluationGetParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", evaluation.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Create a new Evaluation `client.AIGateway.Evaluations.New(ctx, gatewayID, params) (*EvaluationNewResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Creates a new AI Gateway. ### Parameters - `gatewayID string` gateway id - `params EvaluationNewParams` - `AccountID param.Field[string]` Path param - `DatasetIDs param.Field[[]string]` Body param - `EvaluationTypeIDs param.Field[[]string]` Body param - `Name param.Field[string]` Body param ### Returns - `type EvaluationNewResponse struct{…}` - `ID string` - `CreatedAt Time` - `Datasets []EvaluationNewResponseDataset` - `ID string` - `AccountID string` - `AccountTag string` - `CreatedAt Time` - `Enable bool` - `Filters []EvaluationNewResponseDatasetsFilter` - `Key EvaluationNewResponseDatasetsFiltersKey` - `const EvaluationNewResponseDatasetsFiltersKeyCreatedAt EvaluationNewResponseDatasetsFiltersKey = "created_at"` - `const EvaluationNewResponseDatasetsFiltersKeyRequestContentType EvaluationNewResponseDatasetsFiltersKey = "request_content_type"` - `const EvaluationNewResponseDatasetsFiltersKeyResponseContentType EvaluationNewResponseDatasetsFiltersKey = "response_content_type"` - `const EvaluationNewResponseDatasetsFiltersKeySuccess EvaluationNewResponseDatasetsFiltersKey = "success"` - `const EvaluationNewResponseDatasetsFiltersKeyCached EvaluationNewResponseDatasetsFiltersKey = "cached"` - `const EvaluationNewResponseDatasetsFiltersKeyProvider EvaluationNewResponseDatasetsFiltersKey = "provider"` - `const EvaluationNewResponseDatasetsFiltersKeyModel EvaluationNewResponseDatasetsFiltersKey = "model"` - `const EvaluationNewResponseDatasetsFiltersKeyCost EvaluationNewResponseDatasetsFiltersKey = "cost"` - `const EvaluationNewResponseDatasetsFiltersKeyTokens EvaluationNewResponseDatasetsFiltersKey = "tokens"` - `const EvaluationNewResponseDatasetsFiltersKeyTokensIn EvaluationNewResponseDatasetsFiltersKey = "tokens_in"` - `const EvaluationNewResponseDatasetsFiltersKeyTokensOut EvaluationNewResponseDatasetsFiltersKey = "tokens_out"` - `const EvaluationNewResponseDatasetsFiltersKeyDuration EvaluationNewResponseDatasetsFiltersKey = "duration"` - `const EvaluationNewResponseDatasetsFiltersKeyFeedback EvaluationNewResponseDatasetsFiltersKey = "feedback"` - `Operator EvaluationNewResponseDatasetsFiltersOperator` - `const EvaluationNewResponseDatasetsFiltersOperatorEq EvaluationNewResponseDatasetsFiltersOperator = "eq"` - `const EvaluationNewResponseDatasetsFiltersOperatorContains EvaluationNewResponseDatasetsFiltersOperator = "contains"` - `const EvaluationNewResponseDatasetsFiltersOperatorLt EvaluationNewResponseDatasetsFiltersOperator = "lt"` - `const EvaluationNewResponseDatasetsFiltersOperatorGt EvaluationNewResponseDatasetsFiltersOperator = "gt"` - `Value []EvaluationNewResponseDatasetsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `Processed bool` - `Results []EvaluationNewResponseResult` - `ID string` - `CreatedAt Time` - `EvaluationID string` - `EvaluationTypeID string` - `ModifiedAt Time` - `Result string` - `Status float64` - `StatusDescription string` - `TotalLogs float64` - `TotalLogs float64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) evaluation, err := client.AIGateway.Evaluations.New( context.TODO(), "my-gateway", ai_gateway.EvaluationNewParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), DatasetIDs: cloudflare.F([]string{"string"}), EvaluationTypeIDs: cloudflare.F([]string{"string"}), Name: cloudflare.F("name"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", evaluation.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Delete a Evaluation `client.AIGateway.Evaluations.Delete(ctx, gatewayID, id, body) (*EvaluationDeleteResponse, error)` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Deletes an AI Gateway dataset. ### Parameters - `gatewayID string` gateway id - `id string` - `body EvaluationDeleteParams` - `AccountID param.Field[string]` ### Returns - `type EvaluationDeleteResponse struct{…}` - `ID string` - `CreatedAt Time` - `Datasets []EvaluationDeleteResponseDataset` - `ID string` - `AccountID string` - `AccountTag string` - `CreatedAt Time` - `Enable bool` - `Filters []EvaluationDeleteResponseDatasetsFilter` - `Key EvaluationDeleteResponseDatasetsFiltersKey` - `const EvaluationDeleteResponseDatasetsFiltersKeyCreatedAt EvaluationDeleteResponseDatasetsFiltersKey = "created_at"` - `const EvaluationDeleteResponseDatasetsFiltersKeyRequestContentType EvaluationDeleteResponseDatasetsFiltersKey = "request_content_type"` - `const EvaluationDeleteResponseDatasetsFiltersKeyResponseContentType EvaluationDeleteResponseDatasetsFiltersKey = "response_content_type"` - `const EvaluationDeleteResponseDatasetsFiltersKeySuccess EvaluationDeleteResponseDatasetsFiltersKey = "success"` - `const EvaluationDeleteResponseDatasetsFiltersKeyCached EvaluationDeleteResponseDatasetsFiltersKey = "cached"` - `const EvaluationDeleteResponseDatasetsFiltersKeyProvider EvaluationDeleteResponseDatasetsFiltersKey = "provider"` - `const EvaluationDeleteResponseDatasetsFiltersKeyModel EvaluationDeleteResponseDatasetsFiltersKey = "model"` - `const EvaluationDeleteResponseDatasetsFiltersKeyCost EvaluationDeleteResponseDatasetsFiltersKey = "cost"` - `const EvaluationDeleteResponseDatasetsFiltersKeyTokens EvaluationDeleteResponseDatasetsFiltersKey = "tokens"` - `const EvaluationDeleteResponseDatasetsFiltersKeyTokensIn EvaluationDeleteResponseDatasetsFiltersKey = "tokens_in"` - `const EvaluationDeleteResponseDatasetsFiltersKeyTokensOut EvaluationDeleteResponseDatasetsFiltersKey = "tokens_out"` - `const EvaluationDeleteResponseDatasetsFiltersKeyDuration EvaluationDeleteResponseDatasetsFiltersKey = "duration"` - `const EvaluationDeleteResponseDatasetsFiltersKeyFeedback EvaluationDeleteResponseDatasetsFiltersKey = "feedback"` - `Operator EvaluationDeleteResponseDatasetsFiltersOperator` - `const EvaluationDeleteResponseDatasetsFiltersOperatorEq EvaluationDeleteResponseDatasetsFiltersOperator = "eq"` - `const EvaluationDeleteResponseDatasetsFiltersOperatorContains EvaluationDeleteResponseDatasetsFiltersOperator = "contains"` - `const EvaluationDeleteResponseDatasetsFiltersOperatorLt EvaluationDeleteResponseDatasetsFiltersOperator = "lt"` - `const EvaluationDeleteResponseDatasetsFiltersOperatorGt EvaluationDeleteResponseDatasetsFiltersOperator = "gt"` - `Value []EvaluationDeleteResponseDatasetsFiltersValueUnion` - `UnionString` - `UnionFloat` - `UnionBool` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `GatewayID string` gateway id - `ModifiedAt Time` - `Name string` - `Processed bool` - `Results []EvaluationDeleteResponseResult` - `ID string` - `CreatedAt Time` - `EvaluationID string` - `EvaluationTypeID string` - `ModifiedAt Time` - `Result string` - `Status float64` - `StatusDescription string` - `TotalLogs float64` - `TotalLogs float64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) evaluation, err := client.AIGateway.Evaluations.Delete( context.TODO(), "my-gateway", "id", ai_gateway.EvaluationDeleteParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", evaluation.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` # Dynamic Routing ## List all AI Gateway Dynamic Routes. `client.AIGateway.DynamicRouting.List(ctx, gatewayID, query) (*DynamicRoutingListResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` List all AI Gateway Dynamic Routes. ### Parameters - `gatewayID string` - `query DynamicRoutingListParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingListResponse struct{…}` - `Data DynamicRoutingListResponseData` - `OrderBy string` - `OrderByDirection string` - `Page float64` - `PerPage float64` - `Routes []DynamicRoutingListResponseDataRoute` - `ID string` - `AccountTag string` - `CreatedAt Time` - `Deployment DynamicRoutingListResponseDataRoutesDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingListResponseDataRoutesElement` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `Next DynamicRoutingListResponseDataRoutesElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeStart DynamicRoutingListResponseDataRoutesElementsObjectType = "start"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `False DynamicRoutingListResponseDataRoutesElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingListResponseDataRoutesElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingListResponseDataRoutesElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeConditional DynamicRoutingListResponseDataRoutesElementsObjectType = "conditional"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingListResponseDataRoutesElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypePercentage DynamicRoutingListResponseDataRoutesElementsObjectType = "percentage"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `Fallback DynamicRoutingListResponseDataRoutesElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingListResponseDataRoutesElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingListResponseDataRoutesElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitType` - `const DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitTypeCount DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitTypeCost DynamicRoutingListResponseDataRoutesElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeRate DynamicRoutingListResponseDataRoutesElementsObjectType = "rate"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingListResponseDataRoutesElementsObjectOutputs` - `Fallback DynamicRoutingListResponseDataRoutesElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingListResponseDataRoutesElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingListResponseDataRoutesElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeModel DynamicRoutingListResponseDataRoutesElementsObjectType = "model"` - `type DynamicRoutingListResponseDataRoutesElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingListResponseDataRoutesElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingListResponseDataRoutesElementsObjectType` - `const DynamicRoutingListResponseDataRoutesElementsObjectTypeEnd DynamicRoutingListResponseDataRoutesElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingListResponseDataRoutesVersion` - `Active DynamicRoutingListResponseDataRoutesVersionActive` - `const DynamicRoutingListResponseDataRoutesVersionActiveTrue DynamicRoutingListResponseDataRoutesVersionActive = "true"` - `const DynamicRoutingListResponseDataRoutesVersionActiveFalse DynamicRoutingListResponseDataRoutesVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` - `Success bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dynamicRoutings, err := client.AIGateway.DynamicRouting.List( context.TODO(), "54442216", ai_gateway.DynamicRoutingListParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRoutings.Data) } ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "routes": [ { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } } ] }, "success": true } ``` ## Get an AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.Get(ctx, gatewayID, id, query) (*DynamicRoutingGetResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Get an AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `id string` - `query DynamicRoutingGetParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingGetResponse struct{…}` - `ID string` - `CreatedAt Time` - `Deployment DynamicRoutingGetResponseDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingGetResponseElement` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `Next DynamicRoutingGetResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeStart DynamicRoutingGetResponseElementsObjectType = "start"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `False DynamicRoutingGetResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingGetResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingGetResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeConditional DynamicRoutingGetResponseElementsObjectType = "conditional"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypePercentage DynamicRoutingGetResponseElementsObjectType = "percentage"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingGetResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingGetResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingGetResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingGetResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingGetResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeRate DynamicRoutingGetResponseElementsObjectType = "rate"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeModel DynamicRoutingGetResponseElementsObjectType = "model"` - `type DynamicRoutingGetResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetResponseElementsObjectType` - `const DynamicRoutingGetResponseElementsObjectTypeEnd DynamicRoutingGetResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingGetResponseVersion` - `Active DynamicRoutingGetResponseVersionActive` - `const DynamicRoutingGetResponseVersionActiveTrue DynamicRoutingGetResponseVersionActive = "true"` - `const DynamicRoutingGetResponseVersionActiveFalse DynamicRoutingGetResponseVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.Get( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingGetParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Create a new AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.New(ctx, gatewayID, params) (*DynamicRoutingNewResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` Create a new AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `params DynamicRoutingNewParams` - `AccountID param.Field[string]` Path param - `Elements param.Field[[]DynamicRoutingNewParamsElement]` Body param - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `Next DynamicRoutingNewParamsElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeStart DynamicRoutingNewParamsElementsObjectType = "start"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `False DynamicRoutingNewParamsElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewParamsElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewParamsElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeConditional DynamicRoutingNewParamsElementsObjectType = "conditional"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypePercentage DynamicRoutingNewParamsElementsObjectType = "percentage"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewParamsElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewParamsElementsObjectPropertiesLimitType` - `const DynamicRoutingNewParamsElementsObjectPropertiesLimitTypeCount DynamicRoutingNewParamsElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewParamsElementsObjectPropertiesLimitTypeCost DynamicRoutingNewParamsElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeRate DynamicRoutingNewParamsElementsObjectType = "rate"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewParamsElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeModel DynamicRoutingNewParamsElementsObjectType = "model"` - `type DynamicRoutingNewParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewParamsElementsObjectType` - `const DynamicRoutingNewParamsElementsObjectTypeEnd DynamicRoutingNewParamsElementsObjectType = "end"` - `Name param.Field[string]` Body param ### Returns - `type DynamicRoutingNewResponse struct{…}` - `ID string` - `CreatedAt Time` - `Deployment DynamicRoutingNewResponseDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingNewResponseElement` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `Next DynamicRoutingNewResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeStart DynamicRoutingNewResponseElementsObjectType = "start"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `False DynamicRoutingNewResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeConditional DynamicRoutingNewResponseElementsObjectType = "conditional"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypePercentage DynamicRoutingNewResponseElementsObjectType = "percentage"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingNewResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingNewResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingNewResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeRate DynamicRoutingNewResponseElementsObjectType = "rate"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeModel DynamicRoutingNewResponseElementsObjectType = "model"` - `type DynamicRoutingNewResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewResponseElementsObjectType` - `const DynamicRoutingNewResponseElementsObjectTypeEnd DynamicRoutingNewResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingNewResponseVersion` - `Active DynamicRoutingNewResponseVersionActive` - `const DynamicRoutingNewResponseVersionActiveTrue DynamicRoutingNewResponseVersionActive = "true"` - `const DynamicRoutingNewResponseVersionActiveFalse DynamicRoutingNewResponseVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.New( context.TODO(), "54442216", ai_gateway.DynamicRoutingNewParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), Elements: cloudflare.F([]ai_gateway.DynamicRoutingNewParamsElementUnion{ai_gateway.DynamicRoutingNewParamsElementsObject{ ID: cloudflare.F("id"), Outputs: cloudflare.F(ai_gateway.DynamicRoutingNewParamsElementsObjectOutputs{ Next: cloudflare.F(ai_gateway.DynamicRoutingNewParamsElementsObjectOutputsNext{ ElementID: cloudflare.F("elementId"), }), }), Type: cloudflare.F(ai_gateway.DynamicRoutingNewParamsElementsObjectTypeStart), }}), Name: cloudflare.F("name"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Update an AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.Update(ctx, gatewayID, id, params) (*DynamicRoutingUpdateResponse, error)` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Update an AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `id string` - `params DynamicRoutingUpdateParams` - `AccountID param.Field[string]` Path param - `Name param.Field[string]` Body param ### Returns - `type DynamicRoutingUpdateResponse struct{…}` - `Route DynamicRoutingUpdateResponseRoute` - `ID string` - `AccountTag string` - `CreatedAt Time` - `Deployment DynamicRoutingUpdateResponseRouteDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `Elements []DynamicRoutingUpdateResponseRouteElement` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `Next DynamicRoutingUpdateResponseRouteElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeStart DynamicRoutingUpdateResponseRouteElementsObjectType = "start"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `False DynamicRoutingUpdateResponseRouteElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingUpdateResponseRouteElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingUpdateResponseRouteElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeConditional DynamicRoutingUpdateResponseRouteElementsObjectType = "conditional"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingUpdateResponseRouteElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypePercentage DynamicRoutingUpdateResponseRouteElementsObjectType = "percentage"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `Fallback DynamicRoutingUpdateResponseRouteElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingUpdateResponseRouteElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingUpdateResponseRouteElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitType` - `const DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitTypeCount DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitTypeCost DynamicRoutingUpdateResponseRouteElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeRate DynamicRoutingUpdateResponseRouteElementsObjectType = "rate"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingUpdateResponseRouteElementsObjectOutputs` - `Fallback DynamicRoutingUpdateResponseRouteElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingUpdateResponseRouteElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingUpdateResponseRouteElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeModel DynamicRoutingUpdateResponseRouteElementsObjectType = "model"` - `type DynamicRoutingUpdateResponseRouteElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingUpdateResponseRouteElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingUpdateResponseRouteElementsObjectType` - `const DynamicRoutingUpdateResponseRouteElementsObjectTypeEnd DynamicRoutingUpdateResponseRouteElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `Version DynamicRoutingUpdateResponseRouteVersion` - `Active DynamicRoutingUpdateResponseRouteVersionActive` - `const DynamicRoutingUpdateResponseRouteVersionActiveTrue DynamicRoutingUpdateResponseRouteVersionActive = "true"` - `const DynamicRoutingUpdateResponseRouteVersionActiveFalse DynamicRoutingUpdateResponseRouteVersionActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` - `Success bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.Update( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingUpdateParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), Name: cloudflare.F("Route Name"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.Route) } ``` #### Response ```json { "route": { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Delete an AI Gateway Dynamic Route. `client.AIGateway.DynamicRouting.Delete(ctx, gatewayID, id, body) (*DynamicRoutingDeleteResponse, error)` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Delete an AI Gateway Dynamic Route. ### Parameters - `gatewayID string` - `id string` - `body DynamicRoutingDeleteParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingDeleteResponse struct{…}` - `ID string` - `CreatedAt Time` - `Elements []DynamicRoutingDeleteResponseElement` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `Next DynamicRoutingDeleteResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeStart DynamicRoutingDeleteResponseElementsObjectType = "start"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `False DynamicRoutingDeleteResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingDeleteResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingDeleteResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeConditional DynamicRoutingDeleteResponseElementsObjectType = "conditional"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingDeleteResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypePercentage DynamicRoutingDeleteResponseElementsObjectType = "percentage"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `Fallback DynamicRoutingDeleteResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingDeleteResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingDeleteResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingDeleteResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingDeleteResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingDeleteResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingDeleteResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingDeleteResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeRate DynamicRoutingDeleteResponseElementsObjectType = "rate"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingDeleteResponseElementsObjectOutputs` - `Fallback DynamicRoutingDeleteResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingDeleteResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingDeleteResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeModel DynamicRoutingDeleteResponseElementsObjectType = "model"` - `type DynamicRoutingDeleteResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingDeleteResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingDeleteResponseElementsObjectType` - `const DynamicRoutingDeleteResponseElementsObjectTypeEnd DynamicRoutingDeleteResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) dynamicRouting, err := client.AIGateway.DynamicRouting.Delete( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingDeleteParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", dynamicRouting.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway Dynamic Route Deployments. `client.AIGateway.DynamicRouting.ListDeployments(ctx, gatewayID, id, query) (*DynamicRoutingListDeploymentsResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` List all AI Gateway Dynamic Route Deployments. ### Parameters - `gatewayID string` - `id string` - `query DynamicRoutingListDeploymentsParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingListDeploymentsResponse struct{…}` - `Data DynamicRoutingListDeploymentsResponseData` - `Deployments []DynamicRoutingListDeploymentsResponseDataDeployment` - `CreatedAt string` - `DeploymentID string` - `VersionID string` - `OrderBy string` - `OrderByDirection string` - `Page float64` - `PerPage float64` - `Success bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.DynamicRouting.ListDeployments( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingListDeploymentsParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "deployments": [ { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" } ], "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0 }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Deployment. `client.AIGateway.DynamicRouting.NewDeployment(ctx, gatewayID, id, params) (*DynamicRoutingNewDeploymentResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` Create a new AI Gateway Dynamic Route Deployment. ### Parameters - `gatewayID string` - `id string` - `params DynamicRoutingNewDeploymentParams` - `AccountID param.Field[string]` Path param - `VersionID param.Field[string]` Body param ### Returns - `type DynamicRoutingNewDeploymentResponse struct{…}` - `ID string` - `CreatedAt Time` - `Elements []DynamicRoutingNewDeploymentResponseElement` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `Next DynamicRoutingNewDeploymentResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeStart DynamicRoutingNewDeploymentResponseElementsObjectType = "start"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `False DynamicRoutingNewDeploymentResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewDeploymentResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewDeploymentResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeConditional DynamicRoutingNewDeploymentResponseElementsObjectType = "conditional"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewDeploymentResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypePercentage DynamicRoutingNewDeploymentResponseElementsObjectType = "percentage"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewDeploymentResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewDeploymentResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewDeploymentResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingNewDeploymentResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeRate DynamicRoutingNewDeploymentResponseElementsObjectType = "rate"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewDeploymentResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewDeploymentResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewDeploymentResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewDeploymentResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeModel DynamicRoutingNewDeploymentResponseElementsObjectType = "model"` - `type DynamicRoutingNewDeploymentResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewDeploymentResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewDeploymentResponseElementsObjectType` - `const DynamicRoutingNewDeploymentResponseElementsObjectTypeEnd DynamicRoutingNewDeploymentResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.DynamicRouting.NewDeployment( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingNewDeploymentParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), VersionID: cloudflare.F("54442216"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway Dynamic Route Versions. `client.AIGateway.DynamicRouting.ListVersions(ctx, gatewayID, id, query) (*DynamicRoutingListVersionsResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` List all AI Gateway Dynamic Route Versions. ### Parameters - `gatewayID string` - `id string` - `query DynamicRoutingListVersionsParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingListVersionsResponse struct{…}` - `Data DynamicRoutingListVersionsResponseData` - `OrderBy string` - `OrderByDirection string` - `Page float64` - `PerPage float64` - `Versions []DynamicRoutingListVersionsResponseDataVersion` - `Active DynamicRoutingListVersionsResponseDataVersionsActive` - `const DynamicRoutingListVersionsResponseDataVersionsActiveTrue DynamicRoutingListVersionsResponseDataVersionsActive = "true"` - `const DynamicRoutingListVersionsResponseDataVersionsActiveFalse DynamicRoutingListVersionsResponseDataVersionsActive = "false"` - `CreatedAt string` - `Data string` - `VersionID string` - `Success bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.DynamicRouting.ListVersions( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingListVersionsParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "versions": [ { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } ] }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Version. `client.AIGateway.DynamicRouting.NewVersion(ctx, gatewayID, id, params) (*DynamicRoutingNewVersionResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` Create a new AI Gateway Dynamic Route Version. ### Parameters - `gatewayID string` - `id string` - `params DynamicRoutingNewVersionParams` - `AccountID param.Field[string]` Path param - `Elements param.Field[[]DynamicRoutingNewVersionParamsElement]` Body param - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `Next DynamicRoutingNewVersionParamsElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeStart DynamicRoutingNewVersionParamsElementsObjectType = "start"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `False DynamicRoutingNewVersionParamsElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewVersionParamsElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewVersionParamsElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeConditional DynamicRoutingNewVersionParamsElementsObjectType = "conditional"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypePercentage DynamicRoutingNewVersionParamsElementsObjectType = "percentage"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionParamsElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitType` - `const DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitTypeCount DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitTypeCost DynamicRoutingNewVersionParamsElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeRate DynamicRoutingNewVersionParamsElementsObjectType = "rate"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionParamsElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionParamsElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionParamsElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionParamsElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeModel DynamicRoutingNewVersionParamsElementsObjectType = "model"` - `type DynamicRoutingNewVersionParamsElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionParamsElementsObjectOutputs]` - `ElementID string` - `Type DynamicRoutingNewVersionParamsElementsObjectType` - `const DynamicRoutingNewVersionParamsElementsObjectTypeEnd DynamicRoutingNewVersionParamsElementsObjectType = "end"` ### Returns - `type DynamicRoutingNewVersionResponse struct{…}` - `ID string` - `CreatedAt Time` - `Elements []DynamicRoutingNewVersionResponseElement` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `Next DynamicRoutingNewVersionResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeStart DynamicRoutingNewVersionResponseElementsObjectType = "start"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `False DynamicRoutingNewVersionResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingNewVersionResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingNewVersionResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeConditional DynamicRoutingNewVersionResponseElementsObjectType = "conditional"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypePercentage DynamicRoutingNewVersionResponseElementsObjectType = "percentage"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingNewVersionResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeRate DynamicRoutingNewVersionResponseElementsObjectType = "rate"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingNewVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingNewVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingNewVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingNewVersionResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeModel DynamicRoutingNewVersionResponseElementsObjectType = "model"` - `type DynamicRoutingNewVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingNewVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingNewVersionResponseElementsObjectType` - `const DynamicRoutingNewVersionResponseElementsObjectTypeEnd DynamicRoutingNewVersionResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.DynamicRouting.NewVersion( context.TODO(), "54442216", "54442216", ai_gateway.DynamicRoutingNewVersionParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), Elements: cloudflare.F([]ai_gateway.DynamicRoutingNewVersionParamsElementUnion{ai_gateway.DynamicRoutingNewVersionParamsElementsObject{ ID: cloudflare.F("id"), Outputs: cloudflare.F(ai_gateway.DynamicRoutingNewVersionParamsElementsObjectOutputs{ Next: cloudflare.F(ai_gateway.DynamicRoutingNewVersionParamsElementsObjectOutputsNext{ ElementID: cloudflare.F("elementId"), }), }), Type: cloudflare.F(ai_gateway.DynamicRoutingNewVersionParamsElementsObjectTypeStart), }}), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Get an AI Gateway Dynamic Route Version. `client.AIGateway.DynamicRouting.GetVersion(ctx, gatewayID, id, versionID, query) (*DynamicRoutingGetVersionResponse, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}` Get an AI Gateway Dynamic Route Version. ### Parameters - `gatewayID string` - `id string` - `versionID string` - `query DynamicRoutingGetVersionParams` - `AccountID param.Field[string]` ### Returns - `type DynamicRoutingGetVersionResponse struct{…}` - `ID string` - `Active DynamicRoutingGetVersionResponseActive` - `const DynamicRoutingGetVersionResponseActiveTrue DynamicRoutingGetVersionResponseActive = "true"` - `const DynamicRoutingGetVersionResponseActiveFalse DynamicRoutingGetVersionResponseActive = "false"` - `CreatedAt string` - `Data string` - `Elements []DynamicRoutingGetVersionResponseElement` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `Next DynamicRoutingGetVersionResponseElementsObjectOutputsNext` - `ElementID string` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeStart DynamicRoutingGetVersionResponseElementsObjectType = "start"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `False DynamicRoutingGetVersionResponseElementsObjectOutputsFalse` - `ElementID string` - `True DynamicRoutingGetVersionResponseElementsObjectOutputsTrue` - `ElementID string` - `Properties DynamicRoutingGetVersionResponseElementsObjectProperties` - `Conditions unknown` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeConditional DynamicRoutingGetVersionResponseElementsObjectType = "conditional"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypePercentage DynamicRoutingGetVersionResponseElementsObjectType = "percentage"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetVersionResponseElementsObjectProperties` - `Key string` - `Limit float64` - `LimitType DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitType` - `const DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitTypeCount DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitType = "count"` - `const DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitTypeCost DynamicRoutingGetVersionResponseElementsObjectPropertiesLimitType = "cost"` - `Window float64` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeRate DynamicRoutingGetVersionResponseElementsObjectType = "rate"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs DynamicRoutingGetVersionResponseElementsObjectOutputs` - `Fallback DynamicRoutingGetVersionResponseElementsObjectOutputsFallback` - `ElementID string` - `Success DynamicRoutingGetVersionResponseElementsObjectOutputsSuccess` - `ElementID string` - `Properties DynamicRoutingGetVersionResponseElementsObjectProperties` - `Model string` - `Provider string` - `Retries float64` - `Timeout float64` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeModel DynamicRoutingGetVersionResponseElementsObjectType = "model"` - `type DynamicRoutingGetVersionResponseElementsObject struct{…}` - `ID string` - `Outputs map[string, DynamicRoutingGetVersionResponseElementsObjectOutput]` - `ElementID string` - `Type DynamicRoutingGetVersionResponseElementsObjectType` - `const DynamicRoutingGetVersionResponseElementsObjectTypeEnd DynamicRoutingGetVersionResponseElementsObjectType = "end"` - `GatewayID string` - `ModifiedAt Time` - `Name string` - `VersionID string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.AIGateway.DynamicRouting.GetVersion( context.TODO(), "54442216", "54442216", "54442216", ai_gateway.DynamicRoutingGetVersionParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "result": { "id": "id", "active": "true", "created_at": "created_at", "data": "data", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version_id": "version_id" }, "success": true } ``` # Provider Configs ## List Provider Configs `client.AIGateway.ProviderConfigs.List(ctx, gatewayID, params) (*V4PagePaginationArray[ProviderConfigListResponse], error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `gatewayID string` gateway id - `params ProviderConfigListParams` - `AccountID param.Field[string]` Path param - `Page param.Field[int64]` Query param - `PerPage param.Field[int64]` Query param ### Returns - `type ProviderConfigListResponse struct{…}` - `ID string` - `Alias string` - `DefaultConfig bool` - `GatewayID string` gateway id - `ModifiedAt Time` - `ProviderSlug string` - `SecretID string` - `SecretPreview string` - `RateLimit float64` - `RateLimitPeriod float64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.AIGateway.ProviderConfigs.List( context.TODO(), "my-gateway", ai_gateway.ProviderConfigListParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "result": [ { "id": "id", "alias": "alias", "default_config": true, "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "provider_slug": "provider_slug", "secret_id": "secret_id", "secret_preview": "secret_preview", "rate_limit": 0, "rate_limit_period": 0 } ], "success": true } ``` ## Create a new Provider Configs `client.AIGateway.ProviderConfigs.New(ctx, gatewayID, params) (*ProviderConfigNewResponse, error)` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs` Creates a new AI Gateway. ### Parameters - `gatewayID string` gateway id - `params ProviderConfigNewParams` - `AccountID param.Field[string]` Path param - `Alias param.Field[string]` Body param - `DefaultConfig param.Field[bool]` Body param - `ProviderSlug param.Field[string]` Body param - `Secret param.Field[string]` Body param - `SecretID param.Field[string]` Body param - `RateLimit param.Field[float64]` Body param - `RateLimitPeriod param.Field[float64]` Body param ### Returns - `type ProviderConfigNewResponse struct{…}` - `ID string` - `Alias string` - `DefaultConfig bool` - `GatewayID string` gateway id - `ModifiedAt Time` - `ProviderSlug string` - `SecretID string` - `SecretPreview string` - `RateLimit float64` - `RateLimitPeriod float64` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) providerConfig, err := client.AIGateway.ProviderConfigs.New( context.TODO(), "my-gateway", ai_gateway.ProviderConfigNewParams{ AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"), Alias: cloudflare.F("alias"), DefaultConfig: cloudflare.F(true), ProviderSlug: cloudflare.F("provider_slug"), Secret: cloudflare.F("secret"), SecretID: cloudflare.F("secret_id"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", providerConfig.ID) } ``` #### Response ```json { "result": { "id": "id", "alias": "alias", "default_config": true, "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "provider_slug": "provider_slug", "secret_id": "secret_id", "secret_preview": "secret_preview", "rate_limit": 0, "rate_limit_period": 0 }, "success": true } ``` # URLs ## Get Gateway URL `client.AIGateway.URLs.Get(ctx, gatewayID, provider, query) (*string, error)` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}` Retrieves the endpoint URL for an AI Gateway. ### Parameters - `gatewayID string` gateway id - `provider string` - `query URLGetParams` - `AccountID param.Field[string]` ### Returns - `type URLGetResponseEnvelopeResult string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/ai_gateway" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) url, err := client.AIGateway.URLs.Get( context.TODO(), "my-gateway", "workers-ai", ai_gateway.URLGetParams{ AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", url) } ``` #### Response ```json { "result": "result", "success": true } ```