Skip to main content

outfox_openai/spec/admin/project_rate_limits/
project_rate_limits_.rs

1use derive_builder::Builder;
2use serde::{Deserialize, Serialize};
3
4use crate::error::OpenAIError;
5
6/// Represents a project rate limit config.
7#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
8pub struct ProjectRateLimit {
9    /// The object type, which is always `project.rate_limit`
10    pub object: String,
11    /// The identifier, which can be referenced in API endpoints.
12    pub id: String,
13    /// The model this rate limit applies to.
14    pub model: String,
15    /// The maximum requests per minute.
16    pub max_requests_per_1_minute: i64,
17    /// The maximum tokens per minute.
18    pub max_tokens_per_1_minute: i64,
19    /// The maximum images per minute. Only present for relevant models.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub max_images_per_1_minute: Option<i64>,
22    /// The maximum audio megabytes per minute. Only present for relevant models.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub max_audio_megabytes_per_1_minute: Option<i64>,
25    /// The maximum requests per day. Only present for relevant models.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub max_requests_per_1_day: Option<i64>,
28    /// The maximum batch input tokens per day. Only present for relevant models.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub batch_1_day_max_input_tokens: Option<i64>,
31}
32
33/// Represents the response object for listing project rate limits.
34#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
35pub struct ProjectRateLimitListResponse {
36    /// The object type, which is always `list`.
37    pub object: String,
38    /// The list of project rate limits.
39    pub data: Vec<ProjectRateLimit>,
40    /// The ID of the first project rate limit in the list.
41    pub first_id: Option<String>,
42    /// The ID of the last project rate limit in the list.
43    pub last_id: Option<String>,
44    /// Indicates if there are more project rate limits available.
45    pub has_more: bool,
46}
47
48/// The project rate limit update request payload.
49#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Builder, Default)]
50#[builder(name = "ProjectRateLimitUpdateRequestArgs")]
51#[builder(pattern = "mutable")]
52#[builder(setter(into, strip_option), default)]
53#[builder(derive(Debug))]
54#[builder(build_fn(error = "OpenAIError"))]
55pub struct ProjectRateLimitUpdateRequest {
56    /// The maximum requests per minute.
57    pub max_requests_per_1_minute: Option<i64>,
58    /// The maximum tokens per minute.
59    pub max_tokens_per_1_minute: Option<i64>,
60    /// The maximum images per minute. Only relevant for certain models.
61    pub max_images_per_1_minute: Option<i64>,
62    /// The maximum audio megabytes per minute. Only relevant for certain models.
63    pub max_audio_megabytes_per_1_minute: Option<i64>,
64    /// The maximum requests per day. Only relevant for certain models.
65    pub max_requests_per_1_day: Option<i64>,
66    /// The maximum batch input tokens per day. Only relevant for certain models.
67    pub batch_1_day_max_input_tokens: Option<i64>,
68}