Skip to content
Start here

Get time series distribution of Workers AI inference by dimension.

client.Radar.AI.Inference.TimeseriesGroupsV2(ctx, dimension, query) (*AIInferenceTimeseriesGroupsV2Response, error)
GET/radar/ai/inference/timeseries_groups/{dimension}

Retrieves the distribution of the number of inferences run on Workers AI, grouped by the specified dimension over time.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
User Details WriteUser Details Read
ParametersExpand Collapse

Specifies the attribute by which to group the results.

One of the following:
const AIInferenceTimeseriesGroupsV2ParamsDimensionModel AIInferenceTimeseriesGroupsV2ParamsDimension = "MODEL"
const AIInferenceTimeseriesGroupsV2ParamsDimensionTask AIInferenceTimeseriesGroupsV2ParamsDimension = "TASK"
query AIInferenceTimeseriesGroupsV2Params
AggInterval param.Field[AIInferenceTimeseriesGroupsV2ParamsAggInterval]Optional

Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals.

const AIInferenceTimeseriesGroupsV2ParamsAggInterval15m AIInferenceTimeseriesGroupsV2ParamsAggInterval = "15m"
const AIInferenceTimeseriesGroupsV2ParamsAggInterval1h AIInferenceTimeseriesGroupsV2ParamsAggInterval = "1h"
const AIInferenceTimeseriesGroupsV2ParamsAggInterval1d AIInferenceTimeseriesGroupsV2ParamsAggInterval = "1d"
const AIInferenceTimeseriesGroupsV2ParamsAggInterval1w AIInferenceTimeseriesGroupsV2ParamsAggInterval = "1w"
ASN param.Field[[]string]Optional

Filters results by Autonomous System. Specify one or more Autonomous System Numbers (ASNs) as a comma-separated list. Prefix with - to exclude ASNs from results. For example, -174, 3356 excludes results from AS174, but includes results from AS3356.

Continent param.Field[[]string]Optional

Filters results by continent. Specify a comma-separated list of alpha-2 codes. Prefix with - to exclude continents from results. For example, -EU,NA excludes results from EU, but includes results from NA.

DateEnd param.Field[[]Time]Optional

End of the date range (inclusive).

DateRange param.Field[[]string]Optional

Filters results by date range. For example, use 7d and 7dcontrol to compare this week with the previous week. Use this parameter or set specific start and end dates (dateStart and dateEnd parameters).

DateStart param.Field[[]Time]Optional

Start of the date range.

Format param.Field[AIInferenceTimeseriesGroupsV2ParamsFormat]Optional

Format in which results will be returned.

const AIInferenceTimeseriesGroupsV2ParamsFormatJson AIInferenceTimeseriesGroupsV2ParamsFormat = "JSON"
const AIInferenceTimeseriesGroupsV2ParamsFormatCsv AIInferenceTimeseriesGroupsV2ParamsFormat = "CSV"
LimitPerGroup param.Field[int64]Optional

Limits the number of objects per group to the top items within the specified time range. When item count exceeds the limit, extra items appear grouped under an “other” category.

Location param.Field[[]string]Optional

Filters results by location. Specify a comma-separated list of alpha-2 codes. Prefix with - to exclude locations from results. For example, -US,PT excludes results from the US, but includes results from PT.

Name param.Field[[]string]Optional

Array of names used to label the series in the response.

Normalization param.Field[AIInferenceTimeseriesGroupsV2ParamsNormalization]Optional

Normalization method applied to the results. Refer to Normalization methods.

const AIInferenceTimeseriesGroupsV2ParamsNormalizationPercentage AIInferenceTimeseriesGroupsV2ParamsNormalization = "PERCENTAGE"
const AIInferenceTimeseriesGroupsV2ParamsNormalizationMin0Max AIInferenceTimeseriesGroupsV2ParamsNormalization = "MIN0_MAX"
ReturnsExpand Collapse
type AIInferenceTimeseriesGroupsV2Response struct{…}
Meta AIInferenceTimeseriesGroupsV2ResponseMeta

Metadata for the results.

AggInterval AIInferenceTimeseriesGroupsV2ResponseMetaAggInterval

Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals.

One of the following:
const AIInferenceTimeseriesGroupsV2ResponseMetaAggIntervalFifteenMinutes AIInferenceTimeseriesGroupsV2ResponseMetaAggInterval = "FIFTEEN_MINUTES"
const AIInferenceTimeseriesGroupsV2ResponseMetaAggIntervalOneHour AIInferenceTimeseriesGroupsV2ResponseMetaAggInterval = "ONE_HOUR"
const AIInferenceTimeseriesGroupsV2ResponseMetaAggIntervalOneDay AIInferenceTimeseriesGroupsV2ResponseMetaAggInterval = "ONE_DAY"
const AIInferenceTimeseriesGroupsV2ResponseMetaAggIntervalOneWeek AIInferenceTimeseriesGroupsV2ResponseMetaAggInterval = "ONE_WEEK"
const AIInferenceTimeseriesGroupsV2ResponseMetaAggIntervalOneMonth AIInferenceTimeseriesGroupsV2ResponseMetaAggInterval = "ONE_MONTH"
ConfidenceInfo AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfo
Annotations []AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotation
DataSource AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource

Data source for annotations.

One of the following:
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceAll AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "ALL"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceAIBots AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "AI_BOTS"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceAIGateway AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "AI_GATEWAY"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceBGP AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "BGP"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceBots AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "BOTS"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceConnectionAnomaly AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "CONNECTION_ANOMALY"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceCT AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "CT"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceDNS AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "DNS"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceDNSMagnitude AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_MAGNITUDE"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceDNSAS112 AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "DNS_AS112"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceDos AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "DOS"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceEmailRouting AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_ROUTING"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceEmailSecurity AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "EMAIL_SECURITY"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceFw AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "FW"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceFwPg AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "FW_PG"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceHTTP AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceHTTPControl AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CONTROL"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceHTTPCrawlerReferer AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_CRAWLER_REFERER"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceHTTPOrigins AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "HTTP_ORIGINS"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceIQI AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "IQI"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceLeakedCredentials AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "LEAKED_CREDENTIALS"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceNet AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "NET"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceRobotsTXT AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "ROBOTS_TXT"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceSpeed AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "SPEED"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceWorkersAI AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSource = "WORKERS_AI"
Description string
EndDate Time
formatdate-time
EventType AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventType

Event type for annotations.

One of the following:
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventTypeEvent AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventType = "EVENT"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventTypeGeneral AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventType = "GENERAL"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventTypeOutage AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventType = "OUTAGE"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventTypePartialProjection AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventType = "PARTIAL_PROJECTION"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventTypePipeline AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventType = "PIPELINE"
const AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventTypeTrafficAnomaly AIInferenceTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventType = "TRAFFIC_ANOMALY"
IsInstantaneous bool

Whether event is a single point in time or a time range.

LinkedURL string
formaturi
StartDate Time
formatdate-time
Tags []stringOptional
Level int64

Provides an indication of how much confidence Cloudflare has in the data.

DateRange []AIInferenceTimeseriesGroupsV2ResponseMetaDateRange
EndTime Time

Adjusted end of date range.

formatdate-time
StartTime Time

Adjusted start of date range.

formatdate-time
LastUpdated Time

Timestamp of the last dataset update.

formatdate-time
Normalization AIInferenceTimeseriesGroupsV2ResponseMetaNormalization

Normalization method applied to the results. Refer to Normalization methods.

One of the following:
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationPercentage AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "PERCENTAGE"
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationMin0Max AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "MIN0_MAX"
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationMinMax AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "MIN_MAX"
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationRawValues AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "RAW_VALUES"
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationPercentageChange AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "PERCENTAGE_CHANGE"
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationRollingAverage AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "ROLLING_AVERAGE"
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationOverlappedPercentage AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "OVERLAPPED_PERCENTAGE"
const AIInferenceTimeseriesGroupsV2ResponseMetaNormalizationRatio AIInferenceTimeseriesGroupsV2ResponseMetaNormalization = "RATIO"
Units []AIInferenceTimeseriesGroupsV2ResponseMetaUnit

Measurement units for the results.

Name string
Value string
Serie0 AIInferenceTimeseriesGroupsV2ResponseSerie0
Timestamps []Time

Get time series distribution of Workers AI inference by dimension.

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/option"
  "github.com/stainless-sdks/cloudflare-go/radar"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.Radar.AI.Inference.TimeseriesGroupsV2(
    context.TODO(),
    radar.AIInferenceTimeseriesGroupsV2ParamsDimensionModel,
    radar.AIInferenceTimeseriesGroupsV2Params{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Meta)
}
{
  "result": {
    "meta": {
      "aggInterval": "FIFTEEN_MINUTES",
      "confidenceInfo": {
        "annotations": [
          {
            "dataSource": "ALL",
            "description": "Cable cut in Tonga",
            "endDate": "2019-12-27T18:11:19.117Z",
            "eventType": "EVENT",
            "isInstantaneous": true,
            "linkedUrl": "https://example.com",
            "startDate": "2019-12-27T18:11:19.117Z",
            "tags": [
              "BOT_CLASS"
            ]
          }
        ],
        "level": 0
      },
      "dateRange": [
        {
          "endTime": "2022-09-17T10:22:57.555Z",
          "startTime": "2022-09-16T10:22:57.555Z"
        }
      ],
      "lastUpdated": "2019-12-27T18:11:19.117Z",
      "normalization": "PERCENTAGE",
      "units": [
        {
          "name": "*",
          "value": "requests"
        }
      ]
    },
    "serie_0": {
      "timestamps": [
        "2023-08-08T10:15:00Z"
      ]
    }
  },
  "success": true
}
Returns Examples
{
  "result": {
    "meta": {
      "aggInterval": "FIFTEEN_MINUTES",
      "confidenceInfo": {
        "annotations": [
          {
            "dataSource": "ALL",
            "description": "Cable cut in Tonga",
            "endDate": "2019-12-27T18:11:19.117Z",
            "eventType": "EVENT",
            "isInstantaneous": true,
            "linkedUrl": "https://example.com",
            "startDate": "2019-12-27T18:11:19.117Z",
            "tags": [
              "BOT_CLASS"
            ]
          }
        ],
        "level": 0
      },
      "dateRange": [
        {
          "endTime": "2022-09-17T10:22:57.555Z",
          "startTime": "2022-09-16T10:22:57.555Z"
        }
      ],
      "lastUpdated": "2019-12-27T18:11:19.117Z",
      "normalization": "PERCENTAGE",
      "units": [
        {
          "name": "*",
          "value": "requests"
        }
      ]
    },
    "serie_0": {
      "timestamps": [
        "2023-08-08T10:15:00Z"
      ]
    }
  },
  "success": true
}