Get code interpreter sessions usage details for the organization.

GET /organization/usage/code_interpreter_sessions

Query parameters

  • start_time integer Required

    Start time (Unix seconds) of the query time range, inclusive.

  • end_time integer

    End time (Unix seconds) of the query time range, exclusive.

  • bucket_width string

    Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.

    Values are 1m, 1h, or 1d. Default value is 1d.

  • project_ids array[string]

    Return only usage for these projects.

  • group_by array[string]

    Group the usage data by the specified fields. Support fields include project_id.

    Value is project_id.

  • limit integer

    Specifies the number of buckets to return.

    • bucket_width=1d: default: 7, max: 31
    • bucket_width=1h: default: 24, max: 168
    • bucket_width=1m: default: 60, max: 1440
  • page string

    A cursor for use in pagination. Corresponding to the next_page field from the previous response.

Responses

  • 200 application/json

    Usage data retrieved successfully.

    Hide response attributes Show response attributes object
    • object string Required

      Value is page.

    • data array[object] Required
      Hide data attributes Show data attributes object
      • object string Required

        Value is bucket.

      • start_time integer Required
      • end_time integer Required
      • result array[object] Required
        One of:

        The aggregated completions usage details of the specific time bucket.

        Hide attributes Show attributes
        • object string Required

          Value is organization.usage.completions.result.

        • input_tokens integer Required

          The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

        • input_cached_tokens integer

          The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.

        • output_tokens integer Required

          The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

        • input_audio_tokens integer

          The aggregated number of audio input tokens used, including cached tokens.

        • output_audio_tokens integer

          The aggregated number of audio output tokens used.

        • num_model_requests integer Required

          The count of requests made to the model.

        • project_id string | null

          When group_by=project_id, this field provides the project ID of the grouped usage result.

        • user_id string | null

          When group_by=user_id, this field provides the user ID of the grouped usage result.

        • api_key_id string | null

          When group_by=api_key_id, this field provides the API key ID of the grouped usage result.

        • model string | null

          When group_by=model, this field provides the model name of the grouped usage result.

        • batch boolean | null

          When group_by=batch, this field tells whether the grouped usage result is batch or not.

    • has_more boolean Required
    • next_page string Required
GET /organization/usage/code_interpreter_sessions
curl \
 --request GET 'https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=42' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "object": "page",
  "data": [
    {
      "object": "bucket",
      "start_time": 42,
      "end_time": 42,
      "result": [
        {
          "object": "organization.usage.completions.result",
          "input_tokens": 42,
          "input_cached_tokens": 42,
          "output_tokens": 42,
          "input_audio_tokens": 42,
          "output_audio_tokens": 42,
          "num_model_requests": 42,
          "project_id": "string",
          "user_id": "string",
          "api_key_id": "string",
          "model": "string",
          "batch": true
        }
      ]
    }
  ],
  "has_more": true,
  "next_page": "string"
}