feat: sync deployed v1.0.0-rc.38-custom.42

Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
cneicy committed 2026-09-26 04:49:11 +08:00
1 parent aa6c3f50f4
commit ceddfd3d6b
828 files changed
+122253 -13702

No files matched your search

+44 -8
View File
@@ -234,11 +234,12 @@ type Usage struct {
UsageSource string `json:"usage_source,omitempty"`
BillingUsage *BillingUsage `json:"billing_usage,omitempty"`
PromptTokensDetails InputTokenDetails `json:"prompt_tokens_details"`
CompletionTokenDetails OutputTokenDetails `json:"completion_tokens_details"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
InputTokensDetails *InputTokenDetails `json:"input_tokens_details"`
PromptTokensDetails InputTokenDetails `json:"prompt_tokens_details"`
CompletionTokenDetails OutputTokenDetails `json:"completion_tokens_details"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
InputTokensDetails *InputTokenDetails `json:"input_tokens_details"`
OutputTokensDetails *OutputTokenDetails `json:"output_tokens_details,omitempty"`
// claude cache 1h
ClaudeCacheCreation5mTokens int `json:"claude_cache_creation_5_m_tokens"`
@@ -259,8 +260,9 @@ type OpenAIVideoResponse struct {
}
type InputTokenDetails struct {
CachedTokens int `json:"cached_tokens"`
CachedCreationTokens int `json:"cached_creation_tokens,omitempty"`
CachedTokens int `json:"cached_tokens"`
CachedTokensDetails *CachedTokenDetails `json:"cached_tokens_details,omitempty"`
CachedCreationTokens int `json:"cached_creation_tokens,omitempty"`
// CacheWriteTokens is OpenAI's native cache-write count, reported as
// prompt_tokens_details.cache_write_tokens (Chat Completions) or
// input_tokens_details.cache_write_tokens (Responses). It is billed at the
@@ -271,6 +273,40 @@ type InputTokenDetails struct {
ImageTokens int `json:"image_tokens"`
}
// CachedTokenDetails describes subsets of cached_tokens. Pointers distinguish
// an unreported modality from an explicitly reported zero.
type CachedTokenDetails struct {
TextTokens *int `json:"text_tokens,omitempty"`
ImageTokens *int `json:"image_tokens,omitempty"`
AudioTokens *int `json:"audio_tokens,omitempty"`
}
func (d *CachedTokenDetails) HasTokens() bool {
return d != nil && (d.TextTokens != nil && *d.TextTokens != 0 ||
d.ImageTokens != nil && *d.ImageTokens != 0 || d.AudioTokens != nil && *d.AudioTokens != 0)
}
// Clone preserves presence information without sharing mutable usage fields.
func (d InputTokenDetails) Clone() InputTokenDetails {
if d.CachedTokensDetails != nil {
cached := *d.CachedTokensDetails
if cached.TextTokens != nil {
value := *cached.TextTokens
cached.TextTokens = &value
}
if cached.ImageTokens != nil {
value := *cached.ImageTokens
cached.ImageTokens = &value
}
if cached.AudioTokens != nil {
value := *cached.AudioTokens
cached.AudioTokens = &value
}
d.CachedTokensDetails = &cached
}
return d
}
// CacheCreationTokensTotal returns the cache-write token count regardless of
// which field the upstream reported it in: Claude-derived conversions populate
// CachedCreationTokens while OpenAI reports cache_write_tokens natively. Both
@@ -295,7 +331,7 @@ type OutputTokenDetails struct {
type OpenAIResponsesResponse struct {
ID string `json:"id"`
Object string `json:"object"`
CreatedAt int `json:"created_at"`
CreatedAt IntValue `json:"created_at"`
Status json.RawMessage `json:"status"`
Error any `json:"error,omitempty"`
IncompleteDetails *IncompleteDetails `json:"incomplete_details,omitempty"`