121-call table checked against the OpenAI OpenAPI document, admin-key-only client, destructive guards, WebhookVerifier (Standard Webhooks HMAC-SHA256), demo routes under /ai/openai/admin, local and opt-in live tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
63 lines
2.9 KiB
C++
63 lines
2.9 KiB
C++
#pragma once
|
|
|
|
// Static ceilings for the OpenAI organization administration surface. Never
|
|
// autotuned. Values marked (api) are ranges OpenAI documents; the rest are
|
|
// local floors and ceilings chosen here and listed in SPEC.md section 3.
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
namespace molo::openai::admin {
|
|
|
|
struct AdminCaps {
|
|
// Paging.
|
|
static constexpr int kDefaultPageLimit = 20; // (api) default of every list
|
|
static constexpr int kMaxPageLimit = 100; // (api) 1..100 on id-cursor lists
|
|
static constexpr int kMaxListPages = 20; // page walks stop here, loudly
|
|
static constexpr std::size_t kMaxWalkItems = 2000; // items returned by one walk
|
|
static constexpr std::size_t kMaxCursorChars = 512; // after / before / page tokens
|
|
|
|
// Usage and costs: bucket limits per bucket_width (api: the parameter text).
|
|
static constexpr int kMaxBuckets1d = 31;
|
|
static constexpr int kMaxBuckets1h = 168;
|
|
static constexpr int kMaxBuckets1m = 1440;
|
|
static constexpr int kDefaultBuckets1d = 7;
|
|
static constexpr int kMaxCostBuckets = 180; // (api) costs: 1..180, default 7
|
|
static constexpr std::size_t kMaxFilterValues = 100; // values in one array filter
|
|
static constexpr std::size_t kMaxFilterChars = 256; // chars in one filter value
|
|
static constexpr std::size_t kMaxGroupBy = 8;
|
|
static constexpr std::int64_t kMaxTimeSeconds = 4102444800; // 2100-01-01
|
|
|
|
// Names and free text.
|
|
static constexpr std::size_t kMaxNameChars = 256;
|
|
static constexpr std::size_t kMaxEmailChars = 320;
|
|
static constexpr std::size_t kMaxDescriptionChars = 1024;
|
|
static constexpr std::size_t kMaxRoleChars = 128;
|
|
static constexpr std::size_t kMaxPermissions = 256;
|
|
static constexpr std::size_t kMaxInviteProjects = 100;
|
|
static constexpr std::size_t kMaxModelIds = 500;
|
|
static constexpr std::size_t kMaxScopes = 32;
|
|
static constexpr std::int64_t kMaxExpiresInSeconds = 315360000; // 10 years
|
|
static constexpr std::size_t kMaxCertificateIds = 10;
|
|
static constexpr std::size_t kMaxCertificatePemBytes = 64u * 1024u;
|
|
|
|
// Audit logs.
|
|
static constexpr std::size_t kMaxAuditEventTypes = 50;
|
|
|
|
// Webhooks.
|
|
static constexpr std::size_t kMaxWebhookBodyBytes = 1024u * 1024u;
|
|
static constexpr std::size_t kMaxWebhookHeaderChars = 4096;
|
|
static constexpr std::size_t kMaxWebhookSignatures = 8;
|
|
static constexpr std::int64_t kDefaultToleranceSeconds = 300; // SDK default: 5 minutes
|
|
static constexpr std::int64_t kMaxToleranceSeconds = 3600;
|
|
static constexpr std::size_t kMinSecretBytes = 24; // SDK: decoded whsec_ key
|
|
static constexpr std::size_t kMaxSecretChars = 512;
|
|
static constexpr std::size_t kMaxWebhookUrlChars = 2048;
|
|
static constexpr std::size_t kMaxEndpointEventTypes = 64;
|
|
|
|
// Request body ceiling for a single admin call (all bodies are small).
|
|
static constexpr std::size_t kMaxBodyBytes = 256u * 1024u;
|
|
};
|
|
|
|
} // namespace molo::openai::admin
|