@crievo/omni 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +41 -0
- package/README.md +2 -2
- package/bin/omni.mjs +14 -0
- package/docs/onboarding/clone-voice.png +0 -0
- package/docs/onboarding/getting-started.png +0 -0
- package/docs/onboarding/new-video.png +0 -0
- package/docs/onboarding/providers.png +0 -0
- package/docs/onboarding/publish.png +0 -0
- package/docs/onboarding/references.png +0 -0
- package/docs/onboarding.md +212 -0
- package/omnivideo.config.example.json +437 -0
- package/package.json +40 -4
- package/reference/captions.md +156 -0
- package/reference/carousel-contract.md +91 -0
- package/reference/cloud.md +96 -0
- package/reference/learnings.md +792 -0
- package/reference/omnichat.md +305 -0
- package/reference/premiere-mcp.md +91 -0
- package/reference/publish.md +305 -0
- package/reference/scenes-contract.md +109 -0
- package/reference/studio.md +666 -0
- package/reference/voicestudio.md +81 -0
- package/reference/writing-for-voice.md +67 -0
- package/requirements.txt +3 -0
- package/studio/api/app.ts +87 -0
- package/studio/api/lib/errors.ts +33 -0
- package/studio/api/lib/files.ts +41 -0
- package/studio/api/lib/hono.ts +9 -0
- package/studio/api/lib/result.ts +14 -0
- package/studio/api/lib/validate.ts +31 -0
- package/studio/api/lib/video.ts +10 -0
- package/studio/api/middleware/json-charset.ts +11 -0
- package/studio/api/middleware/local-only.ts +32 -0
- package/studio/api/middleware/no-timeout.ts +10 -0
- package/studio/api/routes/admin.ts +18 -0
- package/studio/api/routes/agent-cascade.ts +100 -0
- package/studio/api/routes/agent-history.ts +23 -0
- package/studio/api/routes/agent.ts +162 -0
- package/studio/api/routes/analytics.ts +31 -0
- package/studio/api/routes/approval.ts +60 -0
- package/studio/api/routes/archive.ts +12 -0
- package/studio/api/routes/captions.ts +28 -0
- package/studio/api/routes/carousel.ts +38 -0
- package/studio/api/routes/clone.ts +27 -0
- package/studio/api/routes/create.ts +19 -0
- package/studio/api/routes/events.ts +11 -0
- package/studio/api/routes/export.ts +14 -0
- package/studio/api/routes/media.ts +30 -0
- package/studio/api/routes/omnichat.ts +113 -0
- package/studio/api/routes/onboarding.ts +14 -0
- package/studio/api/routes/publish.ts +40 -0
- package/studio/api/routes/queue.ts +14 -0
- package/studio/api/routes/references.ts +40 -0
- package/studio/api/routes/runner.ts +17 -0
- package/studio/api/routes/schedule.ts +47 -0
- package/studio/api/routes/services.ts +11 -0
- package/studio/api/routes/sessions.ts +27 -0
- package/studio/api/routes/settings.ts +102 -0
- package/studio/api/routes/sound.ts +45 -0
- package/studio/api/routes/thumbnail.ts +18 -0
- package/studio/api/routes/usage.ts +13 -0
- package/studio/api/routes/videos.ts +41 -0
- package/studio/api/routes/voices.ts +71 -0
- package/studio/api/services/admin.ts +113 -0
- package/studio/api/services/agent-cascade.ts +975 -0
- package/studio/api/services/agent-claude.ts +47 -0
- package/studio/api/services/agent-history.ts +103 -0
- package/studio/api/services/agent-persona.ts +77 -0
- package/studio/api/services/agent-tools.ts +2237 -0
- package/studio/api/services/agent-ui-tools.ts +259 -0
- package/studio/api/services/agent-wait.ts +32 -0
- package/studio/api/services/agent.ts +553 -0
- package/studio/api/services/analytics.ts +92 -0
- package/studio/api/services/approval.ts +134 -0
- package/studio/api/services/archive.ts +38 -0
- package/studio/api/services/captions.ts +268 -0
- package/studio/api/services/carousel.ts +206 -0
- package/studio/api/services/classify.ts +196 -0
- package/studio/api/services/clone-phrases.ts +75 -0
- package/studio/api/services/clone.ts +722 -0
- package/studio/api/services/create.ts +421 -0
- package/studio/api/services/events.ts +215 -0
- package/studio/api/services/media.ts +32 -0
- package/studio/api/services/omnichat.ts +624 -0
- package/studio/api/services/onboarding.ts +77 -0
- package/studio/api/services/publish.ts +287 -0
- package/studio/api/services/queue.ts +150 -0
- package/studio/api/services/references.ts +269 -0
- package/studio/api/services/root.ts +60 -0
- package/studio/api/services/services.ts +114 -0
- package/studio/api/services/sessions.ts +1007 -0
- package/studio/api/services/settings.ts +983 -0
- package/studio/api/services/sound.ts +311 -0
- package/studio/api/services/thumbnail.ts +133 -0
- package/studio/api/services/usage.ts +27 -0
- package/studio/api/services/videos.ts +418 -0
- package/studio/api/services/voice-pause.ts +98 -0
- package/studio/api/services/voices.ts +324 -0
- package/studio/runner/runner.ts +244 -0
- package/studio/shared/omni-actions.ts +68 -0
- package/studio/shared/omni-admin.ts +52 -0
- package/studio/shared/omni-farewell.ts +48 -0
- package/studio/shared/omni-hotword.ts +20 -0
- package/studio/shared/omni-screens.ts +228 -0
- package/studio/shared/schemas/admin.ts +15 -0
- package/studio/shared/schemas/agent-cascade.ts +58 -0
- package/studio/shared/schemas/agent-history.ts +73 -0
- package/studio/shared/schemas/agent.ts +50 -0
- package/studio/shared/schemas/analytics.ts +6 -0
- package/studio/shared/schemas/approval.ts +22 -0
- package/studio/shared/schemas/captions.ts +19 -0
- package/studio/shared/schemas/carousel.ts +26 -0
- package/studio/shared/schemas/clone.ts +40 -0
- package/studio/shared/schemas/common.ts +16 -0
- package/studio/shared/schemas/omnichat.ts +54 -0
- package/studio/shared/schemas/onboarding.ts +5 -0
- package/studio/shared/schemas/publish.ts +45 -0
- package/studio/shared/schemas/references.ts +20 -0
- package/studio/shared/schemas/settings.ts +82 -0
- package/studio/shared/schemas/sound.ts +22 -0
- package/studio/shared/schemas/videos.ts +38 -0
- package/studio/shared/schemas/voices.ts +23 -0
- package/studio/shared/types/api.ts +1290 -0
- package/studio/studio.ts +148 -0
- package/studio/tsconfig.json +15 -0
- package/studio/web/assets/logos/cartesia.svg +4 -0
- package/studio/web/assets/logos/elevenlabs.svg +12 -0
- package/studio/web/assets/logos/fish.svg +24 -0
- package/studio/web/assets/logos/omni-black.png +0 -0
- package/studio/web/assets/logos/omni-white.png +0 -0
- package/studio/web/assets/logos/voicestudio.svg +21 -0
- package/studio/web/components/AgentMark.tsx +7 -0
- package/studio/web/components/AgentWalking.tsx +11 -0
- package/studio/web/components/ApiKeyField.tsx +104 -0
- package/studio/web/components/AppShell.tsx +64 -0
- package/studio/web/components/ApprovalNotice.tsx +65 -0
- package/studio/web/components/AvatarGroupIcon.tsx +22 -0
- package/studio/web/components/AvatarNameField.tsx +86 -0
- package/studio/web/components/AvatarPicker.tsx +84 -0
- package/studio/web/components/BrandLogo.tsx +16 -0
- package/studio/web/components/CartesiaPlanSetting.tsx +90 -0
- package/studio/web/components/ClaudeWalking.tsx +32 -0
- package/studio/web/components/CloneVoiceDialog/GuidedScript.tsx +39 -0
- package/studio/web/components/CloneVoiceDialog/LanguageBar.tsx +37 -0
- package/studio/web/components/CloneVoiceDialog/LevelMeter.tsx +31 -0
- package/studio/web/components/CloneVoiceDialog/ProviderChoice.tsx +81 -0
- package/studio/web/components/CloneVoiceDialog/QualityPanel.tsx +62 -0
- package/studio/web/components/CloneVoiceDialog/RecordStep.tsx +50 -0
- package/studio/web/components/CloneVoiceDialog/RecorderBar.tsx +79 -0
- package/studio/web/components/CloneVoiceDialog/RedoSummary.tsx +54 -0
- package/studio/web/components/CloneVoiceDialog/SaveStep.tsx +91 -0
- package/studio/web/components/CloneVoiceDialog/SourceBar.tsx +30 -0
- package/studio/web/components/CloneVoiceDialog/index.tsx +141 -0
- package/studio/web/components/CloneVoiceDialog/types.ts +28 -0
- package/studio/web/components/CloneVoiceDialog/useCloneVoice.ts +528 -0
- package/studio/web/components/ConnectionSignals.tsx +51 -0
- package/studio/web/components/EditVoiceDialog/EditVoiceFooter.tsx +72 -0
- package/studio/web/components/EditVoiceDialog/ProviderCards.tsx +81 -0
- package/studio/web/components/EditVoiceDialog/index.tsx +256 -0
- package/studio/web/components/ErrorBanner.tsx +115 -0
- package/studio/web/components/FinishedTask.tsx +41 -0
- package/studio/web/components/FishModelSetting.tsx +69 -0
- package/studio/web/components/FishPriceSetting.tsx +44 -0
- package/studio/web/components/HumanBanner.tsx +64 -0
- package/studio/web/components/Lightbox.tsx +41 -0
- package/studio/web/components/LogStream.tsx +42 -0
- package/studio/web/components/Markdown.tsx +21 -0
- package/studio/web/components/MissingDmsPanel/BatchSend.tsx +137 -0
- package/studio/web/components/MissingDmsPanel/CommentCard.tsx +168 -0
- package/studio/web/components/MissingDmsPanel/CommentFeed.tsx +45 -0
- package/studio/web/components/MissingDmsPanel/DmBubble.tsx +38 -0
- package/studio/web/components/MissingDmsPanel/ReplyComposer.tsx +63 -0
- package/studio/web/components/MissingDmsPanel/index.tsx +98 -0
- package/studio/web/components/NotFound.tsx +48 -0
- package/studio/web/components/Omni/OmniAvatarPicker.tsx +92 -0
- package/studio/web/components/Omni/OmniCards.tsx +202 -0
- package/studio/web/components/Omni/OmniGlow.tsx +183 -0
- package/studio/web/components/Omni/OmniHistory.tsx +119 -0
- package/studio/web/components/Omni/OmniHotword.tsx +40 -0
- package/studio/web/components/Omni/OmniMicSelect.tsx +92 -0
- package/studio/web/components/Omni/OmniVoiceSample.tsx +81 -0
- package/studio/web/components/Omni/OmniWidget.tsx +743 -0
- package/studio/web/components/Omni/PendingActions.tsx +200 -0
- package/studio/web/components/Omni/Transcript.tsx +127 -0
- package/studio/web/components/OmnichatAccountStatus.tsx +87 -0
- package/studio/web/components/OmnichatRulePanel/RuleConfig.tsx +150 -0
- package/studio/web/components/OmnichatRulePanel/RuleDryRun.tsx +15 -0
- package/studio/web/components/OmnichatRulePanel/RuleEnableConfirm.tsx +42 -0
- package/studio/web/components/OmnichatRulePanel/RuleSkeleton.tsx +18 -0
- package/studio/web/components/OmnichatRulePanel/RuleStatus.tsx +55 -0
- package/studio/web/components/OmnichatRulePanel/index.tsx +115 -0
- package/studio/web/components/OmnichatRulePanel/rule-steps.ts +67 -0
- package/studio/web/components/OmnichatRulePanel/steps/MessageStep.tsx +91 -0
- package/studio/web/components/OmnichatRulePanel/steps/RepliesStep.tsx +201 -0
- package/studio/web/components/OmnichatRulePanel/steps/TriggerStep.tsx +76 -0
- package/studio/web/components/OmnichatRulePanel/steps/types.ts +11 -0
- package/studio/web/components/Palette.tsx +17 -0
- package/studio/web/components/PlatformCard.tsx +109 -0
- package/studio/web/components/PlatformIcon.tsx +19 -0
- package/studio/web/components/ProviderCard.tsx +80 -0
- package/studio/web/components/ProviderDetail.tsx +367 -0
- package/studio/web/components/ProviderLogo.tsx +20 -0
- package/studio/web/components/QueuePanel.tsx +77 -0
- package/studio/web/components/ReferenceActions.tsx +89 -0
- package/studio/web/components/ReferencePicker.tsx +136 -0
- package/studio/web/components/ResultMessage.tsx +7 -0
- package/studio/web/components/RuleForm.tsx +138 -0
- package/studio/web/components/RuleLog.tsx +151 -0
- package/studio/web/components/RunningTask.tsx +23 -0
- package/studio/web/components/SampleList.tsx +55 -0
- package/studio/web/components/SessionPanel.tsx +352 -0
- package/studio/web/components/SettingRow.tsx +14 -0
- package/studio/web/components/SettingsCategorySkeleton.tsx +25 -0
- package/studio/web/components/SidePanel.tsx +77 -0
- package/studio/web/components/Sidebar.tsx +289 -0
- package/studio/web/components/StageStepper.tsx +87 -0
- package/studio/web/components/StudioOffline.tsx +80 -0
- package/studio/web/components/TaskName.tsx +17 -0
- package/studio/web/components/TopBanners.tsx +30 -0
- package/studio/web/components/VideoOmnichatPanel.tsx +287 -0
- package/studio/web/components/VoiceAvatar.tsx +33 -0
- package/studio/web/components/VoiceCarousel.tsx +196 -0
- package/studio/web/components/VoiceCategory.tsx +9 -0
- package/studio/web/components/VoiceModal.tsx +39 -0
- package/studio/web/components/VoiceProfileCard.tsx +75 -0
- package/studio/web/components/VoiceProfilePicker.tsx +107 -0
- package/studio/web/components/VoiceProfilesSettings.tsx +150 -0
- package/studio/web/components/VoiceProviderCard.tsx +118 -0
- package/studio/web/components/VoiceProvidersCard.tsx +26 -0
- package/studio/web/components/WaitList.tsx +21 -0
- package/studio/web/components/icons.tsx +247 -0
- package/studio/web/components/ui/accordion.tsx +47 -0
- package/studio/web/components/ui/badge.tsx +18 -0
- package/studio/web/components/ui/calendar.tsx +43 -0
- package/studio/web/components/ui/chart.tsx +229 -0
- package/studio/web/components/ui/checkbox.tsx +26 -0
- package/studio/web/components/ui/cx.ts +2 -0
- package/studio/web/components/ui/date-time-picker.tsx +84 -0
- package/studio/web/components/ui/panel.tsx +23 -0
- package/studio/web/components/ui/picker.tsx +58 -0
- package/studio/web/components/ui/popover.tsx +24 -0
- package/studio/web/components/ui/select.tsx +89 -0
- package/studio/web/components/ui/skeleton.tsx +10 -0
- package/studio/web/components/ui/slider.tsx +68 -0
- package/studio/web/components/ui/switch.tsx +13 -0
- package/studio/web/components/ui/tooltip.test.tsx +30 -0
- package/studio/web/components/ui/tooltip.tsx +59 -0
- package/studio/web/hooks/useAccounts.ts +27 -0
- package/studio/web/hooks/useAdmin.ts +12 -0
- package/studio/web/hooks/useAnalytics.ts +21 -0
- package/studio/web/hooks/useAvatarAudioReactive.ts +87 -0
- package/studio/web/hooks/useBrowserConnect.ts +48 -0
- package/studio/web/hooks/useClonePlan.ts +14 -0
- package/studio/web/hooks/useConnected.ts +7 -0
- package/studio/web/hooks/useLiveQuery.ts +29 -0
- package/studio/web/hooks/useMenuCollapsed.ts +32 -0
- package/studio/web/hooks/useMicDevices.ts +53 -0
- package/studio/web/hooks/useMissingDms.ts +211 -0
- package/studio/web/hooks/useMissingSetupSteps.ts +26 -0
- package/studio/web/hooks/useNow.ts +11 -0
- package/studio/web/hooks/useOmniAgent.ts +278 -0
- package/studio/web/hooks/useOmniClaude.ts +124 -0
- package/studio/web/hooks/useOmniDock.ts +142 -0
- package/studio/web/hooks/useOmniGreeting.ts +60 -0
- package/studio/web/hooks/useOmniHotword.ts +128 -0
- package/studio/web/hooks/useOmnichat.ts +26 -0
- package/studio/web/hooks/useOnboarding.ts +27 -0
- package/studio/web/hooks/usePost.ts +23 -0
- package/studio/web/hooks/useQueue.ts +10 -0
- package/studio/web/hooks/useReferences.ts +20 -0
- package/studio/web/hooks/useRuleEditor.ts +101 -0
- package/studio/web/hooks/useRunner.ts +24 -0
- package/studio/web/hooks/useSaveAction.ts +23 -0
- package/studio/web/hooks/useSchedule.ts +11 -0
- package/studio/web/hooks/useServices.ts +10 -0
- package/studio/web/hooks/useSessions.ts +15 -0
- package/studio/web/hooks/useSettings.ts +11 -0
- package/studio/web/hooks/useSettingsSection.ts +30 -0
- package/studio/web/hooks/useSidePanel.ts +23 -0
- package/studio/web/hooks/useSound.ts +30 -0
- package/studio/web/hooks/useUsage.ts +11 -0
- package/studio/web/hooks/useVideoVoice.ts +36 -0
- package/studio/web/hooks/useVideos.ts +21 -0
- package/studio/web/hooks/useVoiceProfilePreview.ts +52 -0
- package/studio/web/hooks/useVoiceProfiles.ts +7 -0
- package/studio/web/hooks/useVoiceRunning.ts +10 -0
- package/studio/web/hooks/useVoiceStudioClosed.ts +8 -0
- package/studio/web/index.html +19 -0
- package/studio/web/lib/agent.ts +7 -0
- package/studio/web/lib/alerts.ts +210 -0
- package/studio/web/lib/analytics-metrics.ts +351 -0
- package/studio/web/lib/api.ts +70 -0
- package/studio/web/lib/audio.ts +39 -0
- package/studio/web/lib/avatars.ts +41 -0
- package/studio/web/lib/calendar.ts +218 -0
- package/studio/web/lib/caption-position.ts +249 -0
- package/studio/web/lib/carousel.ts +24 -0
- package/studio/web/lib/chime.ts +42 -0
- package/studio/web/lib/clone-voice.ts +55 -0
- package/studio/web/lib/export.ts +11 -0
- package/studio/web/lib/files.ts +8 -0
- package/studio/web/lib/format.ts +93 -0
- package/studio/web/lib/media.ts +29 -0
- package/studio/web/lib/mic-device.ts +72 -0
- package/studio/web/lib/missing-dms.ts +70 -0
- package/studio/web/lib/omni-cards.ts +42 -0
- package/studio/web/lib/omni-cascade.ts +1067 -0
- package/studio/web/lib/omni-greeting-audio.ts +24 -0
- package/studio/web/lib/omni-hotword.ts +231 -0
- package/studio/web/lib/omni-panel.ts +67 -0
- package/studio/web/lib/omni-realtime.ts +811 -0
- package/studio/web/lib/omni-ui.ts +402 -0
- package/studio/web/lib/omni-wait.ts +174 -0
- package/studio/web/lib/omnichat-api.ts +44 -0
- package/studio/web/lib/orb.ts +270 -0
- package/studio/web/lib/pcm-recorder.ts +115 -0
- package/studio/web/lib/platforms.ts +17 -0
- package/studio/web/lib/providers.ts +27 -0
- package/studio/web/lib/publish-draft.ts +52 -0
- package/studio/web/lib/publish-settings.ts +81 -0
- package/studio/web/lib/query-client.ts +122 -0
- package/studio/web/lib/references.ts +13 -0
- package/studio/web/lib/services.ts +40 -0
- package/studio/web/lib/sessions.ts +103 -0
- package/studio/web/lib/settings-categories.ts +58 -0
- package/studio/web/lib/sound-audio.ts +33 -0
- package/studio/web/lib/sound-timeline.ts +291 -0
- package/studio/web/lib/sse.ts +86 -0
- package/studio/web/lib/stage-history.ts +141 -0
- package/studio/web/lib/stages.ts +344 -0
- package/studio/web/lib/studio-offline.ts +60 -0
- package/studio/web/lib/upload.ts +24 -0
- package/studio/web/lib/video-tabs.ts +118 -0
- package/studio/web/lib/voice-profile-draft.ts +34 -0
- package/studio/web/lib/voice-profiles.ts +3 -0
- package/studio/web/main.tsx +14 -0
- package/studio/web/pages/AdminPage/index.tsx +123 -0
- package/studio/web/pages/AgentPage/components/Measurements.tsx +102 -0
- package/studio/web/pages/AgentPage/index.tsx +28 -0
- package/studio/web/pages/AnalyticsPage/components/About.tsx +52 -0
- package/studio/web/pages/AnalyticsPage/components/ChannelCards.tsx +106 -0
- package/studio/web/pages/AnalyticsPage/components/ChannelView.tsx +137 -0
- package/studio/web/pages/AnalyticsPage/components/CollectionStatus.tsx +46 -0
- package/studio/web/pages/AnalyticsPage/components/Comparison.tsx +68 -0
- package/studio/web/pages/AnalyticsPage/components/Diagnosis.tsx +50 -0
- package/studio/web/pages/AnalyticsPage/components/Highlights.tsx +49 -0
- package/studio/web/pages/AnalyticsPage/components/Hint.tsx +11 -0
- package/studio/web/pages/AnalyticsPage/components/HookVsBody.tsx +100 -0
- package/studio/web/pages/AnalyticsPage/components/HourlyWave.tsx +133 -0
- package/studio/web/pages/AnalyticsPage/components/Insights.tsx +70 -0
- package/studio/web/pages/AnalyticsPage/components/MetricCard.tsx +46 -0
- package/studio/web/pages/AnalyticsPage/components/PlanSection.tsx +40 -0
- package/studio/web/pages/AnalyticsPage/components/ProgressionChart.tsx +155 -0
- package/studio/web/pages/AnalyticsPage/components/ReelBarsChart.tsx +154 -0
- package/studio/web/pages/AnalyticsPage/components/ReelThumb.tsx +19 -0
- package/studio/web/pages/AnalyticsPage/components/ReelView.tsx +290 -0
- package/studio/web/pages/AnalyticsPage/components/ReelsTable.tsx +269 -0
- package/studio/web/pages/AnalyticsPage/components/RequestWithFocus.tsx +38 -0
- package/studio/web/pages/AnalyticsPage/components/SegmentedControl.tsx +35 -0
- package/studio/web/pages/AnalyticsPage/components/VsMedian.tsx +31 -0
- package/studio/web/pages/AnalyticsPage/index.tsx +17 -0
- package/studio/web/pages/GettingStartedPage/index.tsx +174 -0
- package/studio/web/pages/NewVideoPage/components/DeliverablesPicker.tsx +62 -0
- package/studio/web/pages/NewVideoPage/components/FormatPicker.tsx +33 -0
- package/studio/web/pages/NewVideoPage/index.tsx +133 -0
- package/studio/web/pages/NotFoundPage/index.tsx +9 -0
- package/studio/web/pages/OmnichatPage/components/NewFromLink.tsx +59 -0
- package/studio/web/pages/OmnichatPage/components/RuleListItem.tsx +64 -0
- package/studio/web/pages/OmnichatPage/components/RulePreview.tsx +14 -0
- package/studio/web/pages/OmnichatPage/components/RuleView.tsx +88 -0
- package/studio/web/pages/OmnichatPage/index.tsx +153 -0
- package/studio/web/pages/QueuePage/index.tsx +22 -0
- package/studio/web/pages/ReferencePage/components/ReferenceTexts.tsx +131 -0
- package/studio/web/pages/ReferencePage/index.tsx +216 -0
- package/studio/web/pages/ReferencesPage/components/NewReferenceForm.tsx +150 -0
- package/studio/web/pages/ReferencesPage/components/ReferenceCard.tsx +42 -0
- package/studio/web/pages/ReferencesPage/components/ReferenceGridSkeleton.tsx +31 -0
- package/studio/web/pages/ReferencesPage/index.tsx +67 -0
- package/studio/web/pages/SchedulePage/components/CalendarSkeleton.tsx +18 -0
- package/studio/web/pages/SchedulePage/components/DayView.tsx +177 -0
- package/studio/web/pages/SchedulePage/components/HourPicker.tsx +103 -0
- package/studio/web/pages/SchedulePage/components/MonthDayCell.tsx +111 -0
- package/studio/web/pages/SchedulePage/components/MonthView.tsx +47 -0
- package/studio/web/pages/SchedulePage/components/PlatformIcons.tsx +12 -0
- package/studio/web/pages/SchedulePage/components/PostThumb.tsx +15 -0
- package/studio/web/pages/SchedulePage/components/WeekColumn.tsx +75 -0
- package/studio/web/pages/SchedulePage/components/WeekView.tsx +35 -0
- package/studio/web/pages/SchedulePage/index.tsx +285 -0
- package/studio/web/pages/SettingsPage/components/AgentAccounts.tsx +263 -0
- package/studio/web/pages/SettingsPage/components/AgentCategory.tsx +20 -0
- package/studio/web/pages/SettingsPage/components/ModelPicker.tsx +49 -0
- package/studio/web/pages/SettingsPage/components/ModelsSettings.tsx +138 -0
- package/studio/web/pages/SettingsPage/components/PlatformsCategory.tsx +23 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/AccountStatus.tsx +29 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/AutoPublishPanel.tsx +90 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/BrowserConnect.tsx +62 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/CheckField.tsx +19 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/InstagramPanel.tsx +113 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/OmnichatSettingsPanel.tsx +146 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SaveBar.tsx +33 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SchedulePanel.tsx +132 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SettingsCard.tsx +47 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/SettingsCardGroup.tsx +19 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/TextPanel.tsx +55 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/TiktokPanel.tsx +123 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/YoutubePanel.tsx +100 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/badges.tsx +15 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/index.tsx +40 -0
- package/studio/web/pages/SettingsPage/components/PublishingCategory/types.ts +10 -0
- package/studio/web/pages/SettingsPage/components/UsageCategory.tsx +389 -0
- package/studio/web/pages/SettingsPage/components/VoiceProvidersCategory.tsx +97 -0
- package/studio/web/pages/SettingsPage/index.tsx +85 -0
- package/studio/web/pages/VideoPage/components/AudioPlayer.tsx +113 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/AxisField.tsx +50 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionList.tsx +56 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionListItem.tsx +92 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionMargins.tsx +57 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionStyleFields.tsx +70 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/CaptionTextForm.tsx +87 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/ColorField.tsx +37 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/MarginField.tsx +59 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/NumberField.tsx +57 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/PositionControls.tsx +140 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/captionEditor.ts +215 -0
- package/studio/web/pages/VideoPage/components/CaptionPositionEditor/useCaptionPosition.ts +154 -0
- package/studio/web/pages/VideoPage/components/CarouselChangeRequest.tsx +72 -0
- package/studio/web/pages/VideoPage/components/CarouselCompositionStage.tsx +80 -0
- package/studio/web/pages/VideoPage/components/CarouselCreate.tsx +63 -0
- package/studio/web/pages/VideoPage/components/CarouselMissing.tsx +19 -0
- package/studio/web/pages/VideoPage/components/CarouselPublishStage.tsx +173 -0
- package/studio/web/pages/VideoPage/components/CarouselScriptStage.tsx +82 -0
- package/studio/web/pages/VideoPage/components/CarouselSlideCard.tsx +49 -0
- package/studio/web/pages/VideoPage/components/CarouselViewer.tsx +55 -0
- package/studio/web/pages/VideoPage/components/ChangedVoices.tsx +53 -0
- package/studio/web/pages/VideoPage/components/CompositionStage.tsx +78 -0
- package/studio/web/pages/VideoPage/components/CoverPicker.tsx +32 -0
- package/studio/web/pages/VideoPage/components/EditorStage.tsx +53 -0
- package/studio/web/pages/VideoPage/components/LineTakes.tsx +160 -0
- package/studio/web/pages/VideoPage/components/LineTextEditor.tsx +124 -0
- package/studio/web/pages/VideoPage/components/LineVoicePicker.tsx +37 -0
- package/studio/web/pages/VideoPage/components/MediaImage.tsx +25 -0
- package/studio/web/pages/VideoPage/components/MotionScriptStage.tsx +39 -0
- package/studio/web/pages/VideoPage/components/NarrationStage.tsx +70 -0
- package/studio/web/pages/VideoPage/components/PublishForm.tsx +387 -0
- package/studio/web/pages/VideoPage/components/PublishStage.tsx +76 -0
- package/studio/web/pages/VideoPage/components/PublishText.tsx +149 -0
- package/studio/web/pages/VideoPage/components/ScenesApprovalPanel.tsx +278 -0
- package/studio/web/pages/VideoPage/components/ScheduledInfo.tsx +72 -0
- package/studio/web/pages/VideoPage/components/ScriptApprovalPanel.tsx +189 -0
- package/studio/web/pages/VideoPage/components/ScriptStage.tsx +17 -0
- package/studio/web/pages/VideoPage/components/SequencePlayer.tsx +146 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/AddSound.tsx +117 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/AreaSelection.tsx +74 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/BedPanel.tsx +94 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/BedRow.tsx +45 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionOverlay.tsx +44 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionSaveBar.tsx +32 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CaptionsPanel.tsx +22 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/ClipBlock.tsx +111 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/ClipPanel.tsx +76 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/CutsPanel.tsx +44 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EditorTabBar.tsx +73 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectChoice.tsx +46 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectItem.tsx +89 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectPanel.tsx +232 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/EffectsRow.tsx +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/Lane.tsx +39 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/MarkerRow.tsx +40 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/MuteButton.tsx +36 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/NumberInput.tsx +37 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PlanWarnings.tsx +19 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PlayerResizeHandle.tsx +50 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/PreviewControls.tsx +51 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SceneRow.tsx +54 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SettingsPanel.tsx +65 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SoundLibrary.tsx +99 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SoundPreview.tsx +82 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/SpeedPanel.tsx +128 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineDock.tsx +56 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineFooter.tsx +26 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineSkeleton.tsx +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineToolbar.tsx +160 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TimelineTracks.tsx +121 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/TrackSidebar.tsx +30 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/VoiceRow.tsx +53 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/Waveform.tsx +97 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/clipActions.ts +50 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/effectActions.ts +161 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/index.tsx +161 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/timelineGeometry.ts +45 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/types.ts +43 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useAutosave.ts +107 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useEditorShortcuts.ts +168 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useFitHeight.ts +40 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useFollowPlayhead.ts +21 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useListenMix.ts +43 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/usePlayback.ts +231 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/usePlayerWidth.ts +27 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useSoundData.ts +124 -0
- package/studio/web/pages/VideoPage/components/SoundTimeline/useSoundTimeline.ts +511 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/CompareVersions.tsx +111 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionCard.tsx +81 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionMedia.tsx +24 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/VersionText.tsx +15 -0
- package/studio/web/pages/VideoPage/components/StageDrawer/index.tsx +109 -0
- package/studio/web/pages/VideoPage/components/StageProcess.tsx +126 -0
- package/studio/web/pages/VideoPage/components/StageResult.tsx +69 -0
- package/studio/web/pages/VideoPage/components/SwapReference.tsx +92 -0
- package/studio/web/pages/VideoPage/components/ThumbnailPanel.tsx +252 -0
- package/studio/web/pages/VideoPage/components/TimingPanel.tsx +89 -0
- package/studio/web/pages/VideoPage/components/VideoPlayer.tsx +18 -0
- package/studio/web/pages/VideoPage/components/VideoSkeleton.tsx +50 -0
- package/studio/web/pages/VideoPage/components/VideoVoiceInfo.tsx +33 -0
- package/studio/web/pages/VideoPage/components/VideoVoicePicker.tsx +165 -0
- package/studio/web/pages/VideoPage/components/VoicePauseBanner.tsx +56 -0
- package/studio/web/pages/VideoPage/components/WithLogo.tsx +10 -0
- package/studio/web/pages/VideoPage/index.tsx +295 -0
- package/studio/web/pages/VideosPage/components/PublishedOn.tsx +85 -0
- package/studio/web/pages/VideosPage/components/ServicesPanel.tsx +81 -0
- package/studio/web/pages/VideosPage/components/SessionsPanel.tsx +62 -0
- package/studio/web/pages/VideosPage/components/VideoListSkeleton.tsx +25 -0
- package/studio/web/pages/VideosPage/components/VideoRow.tsx +122 -0
- package/studio/web/pages/VideosPage/index.tsx +134 -0
- package/studio/web/pages/VoicePage/index.tsx +28 -0
- package/studio/web/router.tsx +201 -0
- package/studio/web/styles/base/elements.css +55 -0
- package/studio/web/styles/base/utilities.css +25 -0
- package/studio/web/styles/components/badge.css +33 -0
- package/studio/web/styles/components/claude-running.css +27 -0
- package/studio/web/styles/components/claude-session.css +212 -0
- package/studio/web/styles/components/claude-walking.css +92 -0
- package/studio/web/styles/components/clone-voice-save.css +136 -0
- package/studio/web/styles/components/clone-voice.css +379 -0
- package/studio/web/styles/components/controls.css +70 -0
- package/studio/web/styles/components/data-and-image.css +54 -0
- package/studio/web/styles/components/forms.css +132 -0
- package/studio/web/styles/components/human-banner.css +99 -0
- package/studio/web/styles/components/lightbox.css +50 -0
- package/studio/web/styles/components/markdown.css +68 -0
- package/studio/web/styles/components/modal.css +70 -0
- package/studio/web/styles/components/omni-cards.css +105 -0
- package/studio/web/styles/components/omni.css +859 -0
- package/studio/web/styles/components/omnichat.css +538 -0
- package/studio/web/styles/components/panel.css +115 -0
- package/studio/web/styles/components/platform-card.css +140 -0
- package/studio/web/styles/components/provider-card.css +132 -0
- package/studio/web/styles/components/queue.css +185 -0
- package/studio/web/styles/components/reference-actions.css +133 -0
- package/studio/web/styles/components/reference-picker.css +146 -0
- package/studio/web/styles/components/results-drawer.css +224 -0
- package/studio/web/styles/components/segmented.css +115 -0
- package/studio/web/styles/components/side-panel-tab.css +23 -0
- package/studio/web/styles/components/status-signals.css +66 -0
- package/studio/web/styles/components/stepper.css +208 -0
- package/studio/web/styles/components/table.css +19 -0
- package/studio/web/styles/components/tabs.css +24 -0
- package/studio/web/styles/components/ui/accordion.css +71 -0
- package/studio/web/styles/components/ui/chart.css +162 -0
- package/studio/web/styles/components/ui/checkbox.css +37 -0
- package/studio/web/styles/components/ui/date-picker.css +153 -0
- package/studio/web/styles/components/ui/select.css +110 -0
- package/studio/web/styles/components/ui/skeleton.css +25 -0
- package/studio/web/styles/components/ui/slider.css +81 -0
- package/studio/web/styles/components/ui/switch.css +41 -0
- package/studio/web/styles/components/ui/tooltip.css +24 -0
- package/studio/web/styles/components/voice-carousel.css +255 -0
- package/studio/web/styles/components/voice-editor.css +179 -0
- package/studio/web/styles/components/voice-grid.css +56 -0
- package/studio/web/styles/components/voice-profiles.css +192 -0
- package/studio/web/styles/design-system.md +136 -0
- package/studio/web/styles/index.css +116 -0
- package/studio/web/styles/layout/page.css +41 -0
- package/studio/web/styles/layout/sidebar-groups.css +39 -0
- package/studio/web/styles/layout/sidebar.css +111 -0
- package/studio/web/styles/pages/agent.css +26 -0
- package/studio/web/styles/pages/analytics/dashboard.css +614 -0
- package/studio/web/styles/pages/analytics/insights.css +48 -0
- package/studio/web/styles/pages/getting-started.css +166 -0
- package/studio/web/styles/pages/new-video/form.css +32 -0
- package/studio/web/styles/pages/not-found.css +59 -0
- package/studio/web/styles/pages/references.css +204 -0
- package/studio/web/styles/pages/schedule/calendar.css +541 -0
- package/studio/web/styles/pages/schedule/chip-states.css +60 -0
- package/studio/web/styles/pages/settings/models.css +72 -0
- package/studio/web/styles/pages/settings/shell.css +361 -0
- package/studio/web/styles/pages/settings/usage.css +63 -0
- package/studio/web/styles/pages/studio-offline.css +105 -0
- package/studio/web/styles/pages/video/caption-controls.css +194 -0
- package/studio/web/styles/pages/video/captions-grid.css +70 -0
- package/studio/web/styles/pages/video/captions.css +79 -0
- package/studio/web/styles/pages/video/editor-chat.css +103 -0
- package/studio/web/styles/pages/video/export.css +50 -0
- package/studio/web/styles/pages/video/frames.css +29 -0
- package/studio/web/styles/pages/video/fullscreen-stage.css +400 -0
- package/studio/web/styles/pages/video/instagram-carousel.css +309 -0
- package/studio/web/styles/pages/video/layout.css +285 -0
- package/studio/web/styles/pages/video/narration.css +138 -0
- package/studio/web/styles/pages/video/preview-overview.css +11 -0
- package/studio/web/styles/pages/video/processing-notice.css +34 -0
- package/studio/web/styles/pages/video/publish-when.css +76 -0
- package/studio/web/styles/pages/video/publish.css +97 -0
- package/studio/web/styles/pages/video/result.css +96 -0
- package/studio/web/styles/pages/video/scenes.css +167 -0
- package/studio/web/styles/pages/video/sound-timeline.css +672 -0
- package/studio/web/styles/pages/video/sound-toolbar.css +149 -0
- package/studio/web/styles/pages/video/take-player.css +100 -0
- package/studio/web/styles/pages/video/thumbnail.css +157 -0
- package/studio/web/styles/pages/video/timeline.css +117 -0
- package/studio/web/styles/pages/video/voice-picker.css +14 -0
- package/studio/web/styles/pages/video-list/active-row.css +27 -0
- package/studio/web/styles/pages/video-list/card-link.css +49 -0
- package/studio/web/styles/pages/video-list/list.css +86 -0
- package/studio/web/styles/theme/identity/details.css +204 -0
- package/studio/web/styles/theme/identity/shell.css +249 -0
- package/studio/web/styles/theme/identity/surfaces.css +183 -0
- package/studio/web/styles/theme/identity/titles-and-buttons.css +120 -0
- package/studio/web/styles/theme/no-borders/blocks.css +208 -0
- package/studio/web/styles/theme/no-borders/controls.css +256 -0
- package/studio/web/styles/tokens.css +245 -0
- package/studio/web/types/api.ts +2 -0
- package/studio/web/types/assets.d.ts +9 -0
- package/templates/brief.md +27 -0
- package/templates/captions.html +204 -0
- package/templates/carousel-composition.md +47 -0
- package/templates/carousel-script.md +60 -0
- package/templates/components/voiceavatar/README.md +87 -0
- package/templates/components/voiceavatar/demo.html +50 -0
- package/templates/components/voiceavatar/voiceavatar.js +415 -0
- package/templates/motion.md +80 -0
- package/templates/playbook.md +43 -0
- package/templates/reference.md +123 -0
- package/templates/scene.html +112 -0
- package/templates/scenes.example.json +96 -0
- package/templates/script.md +63 -0
- package/templates/slide.html +71 -0
- package/templates/wireframe.html +91 -0
- package/tools/analysis.mjs +300 -0
- package/tools/approval.mjs +442 -0
- package/tools/assemble.mjs +942 -0
- package/tools/build-motion.mjs +437 -0
- package/tools/captions.mjs +246 -0
- package/tools/carousel.mjs +558 -0
- package/tools/compose.mjs +307 -0
- package/tools/cuts.mjs +74 -0
- package/tools/editor.mjs +419 -0
- package/tools/epidemic-capture.js +54 -0
- package/tools/fanout.mjs +69 -0
- package/tools/history.mjs +70 -0
- package/tools/history.py +61 -0
- package/tools/job-queue.mjs +180 -0
- package/tools/job_queue.py +430 -0
- package/tools/lib/agents.mjs +412 -0
- package/tools/lib/channel.mjs +399 -0
- package/tools/lib/claude-settings.mjs +67 -0
- package/tools/lib/cli.mjs +9 -0
- package/tools/lib/fanout.mjs +234 -0
- package/tools/lib/http.mjs +94 -0
- package/tools/lib/index.js +14 -0
- package/tools/lib/mcp-server.mjs +69 -0
- package/tools/lib/metrics/metrics.mjs +204 -0
- package/tools/lib/narration.mjs +15 -0
- package/tools/lib/oauth-client.mjs +295 -0
- package/tools/lib/omnichat/config.mjs +139 -0
- package/tools/lib/omnichat/errors.mjs +42 -0
- package/tools/lib/omnichat/extract.mjs +82 -0
- package/tools/lib/omnichat/gate.mjs +151 -0
- package/tools/lib/omnichat/manual.mjs +166 -0
- package/tools/lib/omnichat/match.mjs +78 -0
- package/tools/lib/omnichat/pass.mjs +393 -0
- package/tools/lib/omnichat/record.mjs +208 -0
- package/tools/lib/omnichat/text.mjs +315 -0
- package/tools/lib/omnichat/webhook.mjs +166 -0
- package/tools/lib/pairing.mjs +99 -0
- package/tools/lib/paths.mjs +41 -0
- package/tools/lib/platforms/instagram.mjs +469 -0
- package/tools/lib/platforms/tiktok.mjs +343 -0
- package/tools/lib/platforms/youtube.mjs +228 -0
- package/tools/lib/publish/publish.mjs +244 -0
- package/tools/lib/schedule/schedule.mjs +191 -0
- package/tools/lib/service.mjs +134 -0
- package/tools/lib/skill-client.mjs +126 -0
- package/tools/lib/skills-release.mjs +196 -0
- package/tools/lib/testing.mjs +52 -0
- package/tools/lib/up.mjs +187 -0
- package/tools/metrics.mjs +415 -0
- package/tools/models.mjs +134 -0
- package/tools/narrate.mjs +257 -0
- package/tools/omni.mjs +298 -0
- package/tools/omni_paths.py +12 -0
- package/tools/omnichat.mjs +1577 -0
- package/tools/omnivideo.py +1122 -0
- package/tools/package.mjs +130 -0
- package/tools/platforms.mjs +236 -0
- package/tools/premiere.mjs +533 -0
- package/tools/publish.mjs +1496 -0
- package/tools/reference.mjs +1408 -0
- package/tools/render.mjs +426 -0
- package/tools/runner.mjs +156 -0
- package/tools/setup.mjs +466 -0
- package/tools/skills-release.mjs +93 -0
- package/tools/sound.mjs +1323 -0
- package/tools/soundtrack.mjs +217 -0
- package/tools/thumbnail.mjs +271 -0
- package/tools/timing.mjs +108 -0
- package/tools/usage.py +628 -0
- package/tools/voice-envelope.mjs +185 -0
- package/tools/voice.py +448 -0
- package/tools/voice_sample.py +75 -0
- package/tools/wireframe.mjs +230 -0
package/tools/usage.py
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Usage of the paid voices: what each generation spent and what is left on each platform.
|
|
3
|
+
|
|
4
|
+
usage.py summary of what is recorded (does not call the platforms)
|
|
5
|
+
usage.py --live asks the platforms now and summarizes
|
|
6
|
+
usage.py summary --json the same as data (what the studio reads)
|
|
7
|
+
usage.py events [--n 30] last records of .usage/events.jsonl
|
|
8
|
+
usage.py keys which keys are filled (without showing values)
|
|
9
|
+
|
|
10
|
+
Two sources, always side by side:
|
|
11
|
+
|
|
12
|
+
record each line generated by omnivideo (provider, video, chars, bytes),
|
|
13
|
+
written by `omnivideo.py voice` to .usage/events.jsonl. It is an
|
|
14
|
+
estimate: it does not see what another app spent on the same account.
|
|
15
|
+
platform what the platform itself says, read at the end of each `voice` run
|
|
16
|
+
and when --live is asked.
|
|
17
|
+
|
|
18
|
+
Fish Audio GET /wallet/self/api-credit with the normal key (FISH_API_KEY): the
|
|
19
|
+
prepaid API balance and the total topped up so far. The cycle's
|
|
20
|
+
spend is the difference of (topped up − balance) between two reads,
|
|
21
|
+
which does not get mixed up with a top-up. The plan's 8k free credits
|
|
22
|
+
belong to the app, not the API. Lines from the `-free` model
|
|
23
|
+
(voice.fish.model) are not charged: the estimated cost counts only
|
|
24
|
+
the paid ones (fallback_model).
|
|
25
|
+
Cartesia GET /usage/credits only accepts an ADMIN key (sk_car_admin_…, in
|
|
26
|
+
CARTESIA_ADMIN_API_KEY) and returns only what was used per window,
|
|
27
|
+
never the balance, and the API does not tell the plan. The quota comes
|
|
28
|
+
from the config (`usage.cartesia`: `plan` + `monthly_quota`, in
|
|
29
|
+
Configurações → Provedores de voz): Free 20k, Pro 100k, Startup 1.25M,
|
|
30
|
+
Scale 8M per month. What is left is the quota minus what was used;
|
|
31
|
+
`cycle_day` is the plan's renewal day (the API slices by UTC day).
|
|
32
|
+
Without the admin key, the usage is the record's estimate.
|
|
33
|
+
|
|
34
|
+
Keys: environment or `.env` at the omnivideo root (outside git), as in voice.py.
|
|
35
|
+
Recording usage never takes voice generation down: every failure here becomes a warning.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
import argparse
|
|
39
|
+
import json
|
|
40
|
+
import os
|
|
41
|
+
import ssl
|
|
42
|
+
import sys
|
|
43
|
+
import threading
|
|
44
|
+
import urllib.error
|
|
45
|
+
import urllib.parse
|
|
46
|
+
import urllib.request
|
|
47
|
+
import uuid
|
|
48
|
+
from datetime import datetime, timezone
|
|
49
|
+
from pathlib import Path
|
|
50
|
+
|
|
51
|
+
import voice
|
|
52
|
+
from omni_paths import DATA_ROOT as ROOT
|
|
53
|
+
|
|
54
|
+
DIR = Path(os.environ.get("OMNIVIDEO_USAGE_DIR") or ROOT / ".usage") # the override is for tests
|
|
55
|
+
EVENTS_FILE = DIR / "events.jsonl"
|
|
56
|
+
CFG = voice.CFG
|
|
57
|
+
UTC = timezone.utc
|
|
58
|
+
|
|
59
|
+
DEFAULTS = {
|
|
60
|
+
"fish": {"usd_per_million_bytes": 15.0},
|
|
61
|
+
"cartesia": {
|
|
62
|
+
"plan": "free",
|
|
63
|
+
"monthly_quota": 20000,
|
|
64
|
+
"credits_per_char": 1,
|
|
65
|
+
"admin_key_env": "CARTESIA_ADMIN_API_KEY",
|
|
66
|
+
"cycle_day": 1,
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# credits per month of each Cartesia plan (cartesia.ai/pricing); "other" uses the config's monthly_quota
|
|
71
|
+
CARTESIA_PLANS = {
|
|
72
|
+
"free": ("Free", 20_000),
|
|
73
|
+
"pro": ("Pro", 100_000),
|
|
74
|
+
"startup": ("Startup", 1_250_000),
|
|
75
|
+
"scale": ("Scale", 8_000_000),
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def cfg():
|
|
80
|
+
c = CFG.get("usage") or {}
|
|
81
|
+
return {k: {**DEFAULTS[k], **(c.get(k) or {})} for k in DEFAULTS}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class Unavailable(Exception):
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# --- time --------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def now():
|
|
92
|
+
return datetime.now(UTC)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def iso(dt):
|
|
96
|
+
return dt.astimezone(UTC).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def cycle(ref, day):
|
|
100
|
+
"""Start and end (UTC) of the monthly cycle containing `ref`. Cartesia slices by UTC day."""
|
|
101
|
+
day = min(max(int(day), 1), 28)
|
|
102
|
+
y, m = ref.year, ref.month
|
|
103
|
+
if ref.day < day:
|
|
104
|
+
y, m = (y - 1, 12) if m == 1 else (y, m - 1)
|
|
105
|
+
start = datetime(y, m, day, tzinfo=UTC)
|
|
106
|
+
y2, m2 = (y + 1, 1) if m == 12 else (y, m + 1)
|
|
107
|
+
return start, datetime(y2, m2, day, tzinfo=UTC)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# --- record ------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def record(event):
|
|
114
|
+
DIR.mkdir(exist_ok=True)
|
|
115
|
+
row = json.dumps({"at": iso(now()), **event}, ensure_ascii=False)
|
|
116
|
+
with open(EVENTS_FILE, "a", encoding="utf-8") as f:
|
|
117
|
+
f.write(row + "\n")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def events():
|
|
121
|
+
out = []
|
|
122
|
+
try:
|
|
123
|
+
with open(EVENTS_FILE, encoding="utf-8") as f:
|
|
124
|
+
for row in f:
|
|
125
|
+
try:
|
|
126
|
+
out.append(json.loads(row))
|
|
127
|
+
except ValueError:
|
|
128
|
+
continue
|
|
129
|
+
except FileNotFoundError:
|
|
130
|
+
pass
|
|
131
|
+
return out
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def warn(msg):
|
|
135
|
+
print(f"uso: {msg}", file=sys.stderr)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
# --- platforms ---------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _get(url, headers, params=None, timeout=15):
|
|
142
|
+
if params:
|
|
143
|
+
url += "?" + urllib.parse.urlencode(params)
|
|
144
|
+
req = urllib.request.Request(url, headers={"User-Agent": "omnivideo-usage/1", **headers})
|
|
145
|
+
try:
|
|
146
|
+
with urllib.request.urlopen(req, timeout=timeout, context=_ssl()) as r:
|
|
147
|
+
return r.status, json.loads(r.read().decode() or "{}")
|
|
148
|
+
except urllib.error.HTTPError as e:
|
|
149
|
+
body = e.read().decode(errors="replace")[:300].replace("\n", " ")
|
|
150
|
+
return e.code, {"error": body}
|
|
151
|
+
except (urllib.error.URLError, TimeoutError, OSError, ValueError) as e:
|
|
152
|
+
raise Unavailable(str(e))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _ssl():
|
|
156
|
+
"""VoiceStudio's Python does not ship the root certificates for urllib; `requests`
|
|
157
|
+
(which generates the voice) uses certifi, and so does this."""
|
|
158
|
+
try:
|
|
159
|
+
import certifi
|
|
160
|
+
|
|
161
|
+
return ssl.create_default_context(cafile=certifi.where())
|
|
162
|
+
except ImportError:
|
|
163
|
+
return ssl.create_default_context()
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _num(v):
|
|
167
|
+
try:
|
|
168
|
+
return float(v)
|
|
169
|
+
except (TypeError, ValueError):
|
|
170
|
+
return None
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def fish_key():
|
|
174
|
+
return voice._env().get(CFG["voice"]["fish"]["key_env"])
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def cartesia_key():
|
|
178
|
+
return voice._env().get(CFG["voice"]["cartesia"]["key_env"])
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def cartesia_admin_key():
|
|
182
|
+
return voice._env().get(cfg()["cartesia"]["admin_key_env"])
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def fish_balance(key):
|
|
186
|
+
status, j = _get("https://api.fish.audio/wallet/self/api-credit", {"Authorization": f"Bearer {key}"})
|
|
187
|
+
if status != 200:
|
|
188
|
+
raise Unavailable(f"Fish Audio respondeu {status}: {j.get('error') or j}")
|
|
189
|
+
return {
|
|
190
|
+
"credit": _num(j.get("credit")),
|
|
191
|
+
"cumulative_top_up": _num(j.get("cumulative_top_up")),
|
|
192
|
+
"has_free_credit": j.get("has_free_credit"),
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def cartesia_used(admin, start, end):
|
|
197
|
+
status, j = _get(
|
|
198
|
+
"https://api.cartesia.ai/usage/credits",
|
|
199
|
+
{"Authorization": f"Bearer {admin}", "Cartesia-Version": CFG["voice"]["cartesia"]["api_version"]},
|
|
200
|
+
{"start_ts": iso(start), "end_ts": iso(end), "interval": "day"},
|
|
201
|
+
)
|
|
202
|
+
if status in (401, 403):
|
|
203
|
+
raise Unavailable(
|
|
204
|
+
f"Cartesia recusou a chave admin ({status}): precisa ser sk_car_admin_…, não a chave de geração"
|
|
205
|
+
)
|
|
206
|
+
if status != 200:
|
|
207
|
+
raise Unavailable(f"Cartesia respondeu {status}: {j.get('error') or j}")
|
|
208
|
+
return sum(int(b.get("credits") or 0) for b in j.get("data", []))
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
# --- `voice` hook ------------------------------------------------------------
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class Run:
|
|
215
|
+
"""One run of `omnivideo.py voice`: what was generated and the balance reads."""
|
|
216
|
+
|
|
217
|
+
def __init__(self, video):
|
|
218
|
+
self.id = uuid.uuid4().hex[:8]
|
|
219
|
+
self.video = video
|
|
220
|
+
self.used = set()
|
|
221
|
+
# the lines of a run are generated in parallel: one writer at a time in the log
|
|
222
|
+
self._lock = threading.Lock()
|
|
223
|
+
|
|
224
|
+
def __enter__(self):
|
|
225
|
+
return self
|
|
226
|
+
|
|
227
|
+
def __exit__(self, *_):
|
|
228
|
+
# reads the balance even when generation was interrupted: what was spent was spent
|
|
229
|
+
try:
|
|
230
|
+
self.after()
|
|
231
|
+
except Exception as exc: # recording usage never takes the voice down
|
|
232
|
+
warn(f"leitura de saldo falhou: {exc}")
|
|
233
|
+
return False
|
|
234
|
+
|
|
235
|
+
def _record(self, ev):
|
|
236
|
+
try:
|
|
237
|
+
with self._lock:
|
|
238
|
+
record({"run": self.id, "video": self.video, **ev})
|
|
239
|
+
except OSError as exc:
|
|
240
|
+
warn(f"não consegui gravar o registro: {exc}")
|
|
241
|
+
|
|
242
|
+
def before(self, provider):
|
|
243
|
+
"""Fish balance before generating: the difference to the one after is this run's cost."""
|
|
244
|
+
if provider != "fish" or not fish_key():
|
|
245
|
+
return
|
|
246
|
+
try:
|
|
247
|
+
self._record({"t": "balance", "provider": "fish", "moment": "before", **fish_balance(fish_key())})
|
|
248
|
+
except Unavailable as exc:
|
|
249
|
+
warn(f"saldo da Fish indisponível: {exc}")
|
|
250
|
+
|
|
251
|
+
def line(self, provider, line, audio_s, fallback=False, model=None):
|
|
252
|
+
self.used.add(provider)
|
|
253
|
+
text = line.get("text", "")
|
|
254
|
+
ev = {
|
|
255
|
+
"t": "line",
|
|
256
|
+
"provider": provider,
|
|
257
|
+
"line": line.get("id"),
|
|
258
|
+
"chars": len(text),
|
|
259
|
+
"bytes": len(text.encode("utf-8")),
|
|
260
|
+
"audio_s": round(float(audio_s), 3),
|
|
261
|
+
"fallback": fallback,
|
|
262
|
+
}
|
|
263
|
+
if model:
|
|
264
|
+
ev["model"] = model
|
|
265
|
+
self._record(ev)
|
|
266
|
+
|
|
267
|
+
def failure(self, provider, line_id, reason):
|
|
268
|
+
self._record({"t": "failure", "provider": provider, "line": line_id, "reason": str(reason)[:200]})
|
|
269
|
+
|
|
270
|
+
def after(self):
|
|
271
|
+
"""Reads the platforms used, once per run, at the end of generation."""
|
|
272
|
+
if "fish" in self.used and fish_key():
|
|
273
|
+
try:
|
|
274
|
+
s = fish_balance(fish_key())
|
|
275
|
+
self._record({"t": "balance", "provider": "fish", "moment": "after", **s})
|
|
276
|
+
except Unavailable as exc:
|
|
277
|
+
warn(f"saldo da Fish indisponível: {exc}")
|
|
278
|
+
if "cartesia" in self.used:
|
|
279
|
+
if cartesia_admin_key():
|
|
280
|
+
_cartesia_cycle(self._record, "after")
|
|
281
|
+
else:
|
|
282
|
+
warn("sem CARTESIA_ADMIN_API_KEY: o consumo da Cartesia vai como estimativa (caracteres gerados aqui)")
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def _cartesia_cycle(record_fn, moment):
|
|
286
|
+
start, end = cycle(now(), cfg()["cartesia"]["cycle_day"])
|
|
287
|
+
try:
|
|
288
|
+
used = cartesia_used(cartesia_admin_key(), start, end)
|
|
289
|
+
except Unavailable as exc:
|
|
290
|
+
warn(f"consumo da Cartesia indisponível: {exc}")
|
|
291
|
+
return None
|
|
292
|
+
record_fn(
|
|
293
|
+
{"t": "cycle", "provider": "cartesia", "moment": moment, "used": used, "start": iso(start), "end": iso(end)}
|
|
294
|
+
)
|
|
295
|
+
return used
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def refresh():
|
|
299
|
+
"""Asks the platforms now. Returns the errors, as text, for the screen to show."""
|
|
300
|
+
errors = []
|
|
301
|
+
run = Run(None)
|
|
302
|
+
if fish_key():
|
|
303
|
+
try:
|
|
304
|
+
run._record({"t": "balance", "provider": "fish", "moment": "query", **fish_balance(fish_key())})
|
|
305
|
+
except Unavailable as exc:
|
|
306
|
+
errors.append(f"Fish Audio: {exc}")
|
|
307
|
+
else:
|
|
308
|
+
errors.append(f"Fish Audio: sem {CFG['voice']['fish']['key_env']}")
|
|
309
|
+
if cartesia_admin_key():
|
|
310
|
+
start, end = cycle(now(), cfg()["cartesia"]["cycle_day"])
|
|
311
|
+
try:
|
|
312
|
+
used = cartesia_used(cartesia_admin_key(), start, end)
|
|
313
|
+
run._record(
|
|
314
|
+
{
|
|
315
|
+
"t": "cycle",
|
|
316
|
+
"provider": "cartesia",
|
|
317
|
+
"moment": "query",
|
|
318
|
+
"used": used,
|
|
319
|
+
"start": iso(start),
|
|
320
|
+
"end": iso(end),
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
except Unavailable as exc:
|
|
324
|
+
errors.append(f"Cartesia: {exc}")
|
|
325
|
+
else:
|
|
326
|
+
errors.append(f"Cartesia: sem {cfg()['cartesia']['admin_key_env']} (chave admin); o consumo é estimado")
|
|
327
|
+
return errors
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
# --- summary -----------------------------------------------------------------
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def _sum(evs, field):
|
|
334
|
+
return sum(e.get(field) or 0 for e in evs)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def _paid(e):
|
|
338
|
+
"""A Fish line charged to the balance. A record without a model predates the free one: paid."""
|
|
339
|
+
return e.get("provider") == "fish" and not voice.is_free(e.get("model"))
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def _fish_spend(snaps, start):
|
|
343
|
+
"""API spend (topped up − balance) in the cycle, between the last read before it
|
|
344
|
+
(or the first inside it) and the most recent. None with a single read."""
|
|
345
|
+
valid = [s for s in snaps if s.get("credit") is not None and s.get("cumulative_top_up") is not None]
|
|
346
|
+
if len(valid) < 2:
|
|
347
|
+
return None, None
|
|
348
|
+
before = [s for s in valid if s["at"] < iso(start)]
|
|
349
|
+
ref = before[-1] if before else valid[0]
|
|
350
|
+
last = valid[-1]
|
|
351
|
+
if ref is last:
|
|
352
|
+
return None, None
|
|
353
|
+
spend = (last["cumulative_top_up"] - last["credit"]) - (ref["cumulative_top_up"] - ref["credit"])
|
|
354
|
+
return round(max(spend, 0.0), 6), ref["at"]
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def summary(live=False):
|
|
358
|
+
c = cfg()
|
|
359
|
+
errors = refresh() if live else []
|
|
360
|
+
start, end = cycle(now(), c["cartesia"]["cycle_day"])
|
|
361
|
+
evs = events()
|
|
362
|
+
in_cycle = [e for e in evs if e.get("at", "") >= iso(start)]
|
|
363
|
+
lines = [e for e in in_cycle if e.get("t") == "line"]
|
|
364
|
+
|
|
365
|
+
# --- Fish
|
|
366
|
+
f_lines = [e for e in lines if e["provider"] == "fish"]
|
|
367
|
+
f_paid = [e for e in f_lines if _paid(e)]
|
|
368
|
+
f_bytes = _sum(f_lines, "bytes")
|
|
369
|
+
f_bytes_paid = _sum(f_paid, "bytes")
|
|
370
|
+
fcfg = CFG["voice"]["fish"]
|
|
371
|
+
snaps = [e for e in evs if e.get("t") == "balance" and e.get("provider") == "fish"]
|
|
372
|
+
last = snaps[-1] if snaps else None
|
|
373
|
+
spend, since = _fish_spend(snaps, start)
|
|
374
|
+
price = c["fish"]["usd_per_million_bytes"]
|
|
375
|
+
fish = {
|
|
376
|
+
"name": "Fish Audio",
|
|
377
|
+
"key": bool(fish_key()),
|
|
378
|
+
"voice_id": fcfg.get("voice_id") or None,
|
|
379
|
+
"model": fcfg["model"],
|
|
380
|
+
"fallback_model": fcfg.get("fallback_model"),
|
|
381
|
+
"balance": {
|
|
382
|
+
"credit": last and last.get("credit"),
|
|
383
|
+
"cumulative_top_up": last and last.get("cumulative_top_up"),
|
|
384
|
+
"at": last and last["at"],
|
|
385
|
+
},
|
|
386
|
+
"cycle": {
|
|
387
|
+
"lines": len(f_lines),
|
|
388
|
+
"lines_free": len(f_lines) - len(f_paid),
|
|
389
|
+
"chars": _sum(f_lines, "chars"),
|
|
390
|
+
"bytes": f_bytes,
|
|
391
|
+
"bytes_paid": f_bytes_paid,
|
|
392
|
+
"estimated_usd": round(f_bytes_paid * price / 1e6, 6),
|
|
393
|
+
"platform": spend,
|
|
394
|
+
"platform_since": since,
|
|
395
|
+
},
|
|
396
|
+
"price_usd_per_million_bytes": price,
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
# --- Cartesia
|
|
400
|
+
cc = c["cartesia"]
|
|
401
|
+
c_lines = [e for e in lines if e["provider"] == "cartesia"]
|
|
402
|
+
c_chars = _sum(c_lines, "chars")
|
|
403
|
+
estimated = int(round(c_chars * cc["credits_per_char"]))
|
|
404
|
+
reads = [
|
|
405
|
+
e for e in evs if e.get("t") == "cycle" and e.get("provider") == "cartesia" and e.get("start") == iso(start)
|
|
406
|
+
]
|
|
407
|
+
read = reads[-1] if reads else None
|
|
408
|
+
used = read["used"] if read else estimated
|
|
409
|
+
quota = int(cc["monthly_quota"])
|
|
410
|
+
cartesia = {
|
|
411
|
+
"name": "Cartesia",
|
|
412
|
+
"key": bool(cartesia_key()),
|
|
413
|
+
"admin_key": bool(cartesia_admin_key()),
|
|
414
|
+
"voice_id": CFG["voice"]["cartesia"].get("voice_id") or None,
|
|
415
|
+
"plan": CARTESIA_PLANS[cc["plan"]][0] if cc["plan"] in CARTESIA_PLANS else "Outro",
|
|
416
|
+
"quota": quota,
|
|
417
|
+
"cycle_day": int(cc["cycle_day"]),
|
|
418
|
+
"used": used,
|
|
419
|
+
"source": "platform" if read else "estimated",
|
|
420
|
+
"read_at": read and read["at"],
|
|
421
|
+
"estimated": estimated,
|
|
422
|
+
"remaining": max(quota - used, 0),
|
|
423
|
+
"fraction": round(min(used / quota, 1.0), 4) if quota else 0.0,
|
|
424
|
+
"cycle": {"lines": len(c_lines), "chars": c_chars},
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
# --- VoiceStudio (local, no cost)
|
|
428
|
+
v_lines = [e for e in lines if e["provider"] == "voicestudio"]
|
|
429
|
+
local = {"name": "VoiceStudio", "lines": len(v_lines), "audio_s": round(_sum(v_lines, "audio_s"), 1)}
|
|
430
|
+
|
|
431
|
+
# --- by video
|
|
432
|
+
per = {}
|
|
433
|
+
for e in lines:
|
|
434
|
+
v = per.setdefault(
|
|
435
|
+
e.get("video") or "?",
|
|
436
|
+
{
|
|
437
|
+
"video": e.get("video") or "?",
|
|
438
|
+
"lines": 0,
|
|
439
|
+
"fish_usd": 0.0,
|
|
440
|
+
"cartesia_credits": 0,
|
|
441
|
+
"audio_s": 0.0,
|
|
442
|
+
"providers": set(),
|
|
443
|
+
},
|
|
444
|
+
)
|
|
445
|
+
v["lines"] += 1
|
|
446
|
+
v["audio_s"] += e.get("audio_s") or 0
|
|
447
|
+
v["providers"].add(e["provider"])
|
|
448
|
+
if _paid(e):
|
|
449
|
+
v["fish_usd"] += (e.get("bytes") or 0) * price / 1e6
|
|
450
|
+
elif e["provider"] == "cartesia":
|
|
451
|
+
v["cartesia_credits"] += (e.get("chars") or 0) * cc["credits_per_char"]
|
|
452
|
+
by_video = sorted(per.values(), key=lambda v: (v["fish_usd"], v["cartesia_credits"], v["lines"]), reverse=True)[:12]
|
|
453
|
+
for v in by_video:
|
|
454
|
+
v["fish_usd"] = round(v["fish_usd"], 6)
|
|
455
|
+
v["cartesia_credits"] = int(round(v["cartesia_credits"]))
|
|
456
|
+
v["audio_s"] = round(v["audio_s"], 1)
|
|
457
|
+
v["providers"] = sorted(v["providers"])
|
|
458
|
+
|
|
459
|
+
# --- recent runs (one per `voice`)
|
|
460
|
+
runs = {}
|
|
461
|
+
for e in evs:
|
|
462
|
+
rid = e.get("run")
|
|
463
|
+
if not rid or e.get("t") not in ("line", "failure", "balance", "cycle"):
|
|
464
|
+
continue
|
|
465
|
+
r = runs.setdefault(
|
|
466
|
+
rid,
|
|
467
|
+
{
|
|
468
|
+
"run": rid,
|
|
469
|
+
"at": e["at"],
|
|
470
|
+
"video": e.get("video"),
|
|
471
|
+
"providers": {},
|
|
472
|
+
"failures": [],
|
|
473
|
+
"_before": None,
|
|
474
|
+
"_after": None,
|
|
475
|
+
},
|
|
476
|
+
)
|
|
477
|
+
p = r["providers"].setdefault(e["provider"], {"lines": 0, "bytes": 0, "chars": 0, "audio_s": 0.0})
|
|
478
|
+
if e["t"] == "line":
|
|
479
|
+
p["lines"] += 1
|
|
480
|
+
p["bytes"] += e.get("bytes") or 0
|
|
481
|
+
if _paid(e):
|
|
482
|
+
p["bytes_paid"] = p.get("bytes_paid", 0) + (e.get("bytes") or 0)
|
|
483
|
+
elif e["provider"] == "fish":
|
|
484
|
+
p["lines_free"] = p.get("lines_free", 0) + 1
|
|
485
|
+
p["chars"] += e.get("chars") or 0
|
|
486
|
+
p["audio_s"] += e.get("audio_s") or 0
|
|
487
|
+
elif e["t"] == "failure":
|
|
488
|
+
r["failures"].append({"provider": e["provider"], "line": e.get("line"), "reason": e.get("reason")})
|
|
489
|
+
elif e["t"] == "balance" and e.get("moment") == "before":
|
|
490
|
+
r["_before"] = e
|
|
491
|
+
elif e["t"] == "balance" and e.get("moment") == "after":
|
|
492
|
+
r["_after"] = e
|
|
493
|
+
recent_runs = []
|
|
494
|
+
for r in sorted(runs.values(), key=lambda r: r["at"], reverse=True)[:15]:
|
|
495
|
+
a, d = r.pop("_before"), r.pop("_after")
|
|
496
|
+
for name, p in r["providers"].items():
|
|
497
|
+
p["audio_s"] = round(p["audio_s"], 1)
|
|
498
|
+
if name == "fish":
|
|
499
|
+
p["estimated_usd"] = round(p.get("bytes_paid", 0) * price / 1e6, 6)
|
|
500
|
+
if a and d and a.get("credit") is not None and d.get("credit") is not None:
|
|
501
|
+
p["platform"] = round(max(a["credit"] - d["credit"], 0.0), 6)
|
|
502
|
+
if name == "cartesia":
|
|
503
|
+
p["estimated_credits"] = int(round(p["chars"] * cc["credits_per_char"]))
|
|
504
|
+
if r["failures"] or any(p["lines"] for p in r["providers"].values()):
|
|
505
|
+
recent_runs.append(r)
|
|
506
|
+
|
|
507
|
+
# --- warnings
|
|
508
|
+
warnings = []
|
|
509
|
+
if not fish["key"]:
|
|
510
|
+
warnings.append(f"Fish Audio sem chave: preencha {CFG['voice']['fish']['key_env']} no .env")
|
|
511
|
+
if not cartesia["key"]:
|
|
512
|
+
warnings.append(f"Cartesia sem chave: preencha {CFG['voice']['cartesia']['key_env']} no .env")
|
|
513
|
+
if cartesia["key"] and not cartesia["admin_key"]:
|
|
514
|
+
warnings.append(
|
|
515
|
+
f"Cartesia: sem {cc['admin_key_env']}. A API só mostra o consumo para chave admin "
|
|
516
|
+
f"(sk_car_admin_…); sem ela a tela estima pelos caracteres gerados aqui"
|
|
517
|
+
)
|
|
518
|
+
if quota and cartesia["fraction"] >= 0.8:
|
|
519
|
+
warnings.append(
|
|
520
|
+
f"Cartesia em {round(cartesia['fraction'] * 100)}% da cota do ciclo: sobram {cartesia['remaining']} créditos"
|
|
521
|
+
)
|
|
522
|
+
paid = [m for m in (fish["model"], fish["fallback_model"]) if m and not voice.is_free(m)]
|
|
523
|
+
if paid and fish["balance"]["credit"] is not None and fish["balance"]["credit"] <= 0:
|
|
524
|
+
warnings.append(
|
|
525
|
+
f"Fish Audio sem saldo na API: o {paid[0]} não gera, as falas caem para o próximo provider"
|
|
526
|
+
if paid[0] == fish["model"]
|
|
527
|
+
else f"Fish Audio sem saldo na API: se o {fish['model']} falhar, o {paid[0]} não gera e as falas "
|
|
528
|
+
f"caem para o próximo provider"
|
|
529
|
+
)
|
|
530
|
+
|
|
531
|
+
return {
|
|
532
|
+
"generated_at": iso(now()),
|
|
533
|
+
"cycle": {"start": iso(start), "end": iso(end)},
|
|
534
|
+
"fish": fish,
|
|
535
|
+
"cartesia": cartesia,
|
|
536
|
+
"voicestudio": local,
|
|
537
|
+
"by_video": by_video,
|
|
538
|
+
"runs": recent_runs,
|
|
539
|
+
"warnings": warnings,
|
|
540
|
+
"refresh": {"live": live, "errors": errors},
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
# --- text output -------------------------------------------------------------
|
|
545
|
+
|
|
546
|
+
SOURCE_LABEL = {"platform": "plataforma", "estimated": "estimado"}
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def _local(s):
|
|
550
|
+
if not s:
|
|
551
|
+
return "—"
|
|
552
|
+
return datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=UTC).astimezone().strftime("%d/%m %H:%M")
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
def _utc(s):
|
|
556
|
+
return datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ").strftime("%d/%m")
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
def _lines(n):
|
|
560
|
+
return f"{n} fala" if n == 1 else f"{n} falas"
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
def _n(v, places=0):
|
|
564
|
+
return "—" if v is None else f"{v:,.{places}f}".replace(",", ".")
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
def text(r):
|
|
568
|
+
f, c, v = r["fish"], r["cartesia"], r["voicestudio"]
|
|
569
|
+
out = [f"uso das vozes · ciclo {_utc(r['cycle']['start'])} → {_utc(r['cycle']['end'])} (UTC)", ""]
|
|
570
|
+
out.append("Fish Audio · API pré-paga")
|
|
571
|
+
out.append(f" modelo {f['model']}" + (f" → {f['fallback_model']} se falhar" if f["fallback_model"] else ""))
|
|
572
|
+
out.append(f" saldo {_n(f['balance']['credit'], 4)} (lido em {_local(f['balance']['at'])})")
|
|
573
|
+
out.append(
|
|
574
|
+
f" no ciclo {_lines(f['cycle']['lines'])} ({f['cycle']['lines_free']} free) · {_n(f['cycle']['bytes'])} bytes · "
|
|
575
|
+
f"estimado US$ {f['cycle']['estimated_usd']:.4f}"
|
|
576
|
+
+ (f" · plataforma {_n(f['cycle']['platform'], 4)}" if f["cycle"]["platform"] is not None else "")
|
|
577
|
+
)
|
|
578
|
+
out.append("")
|
|
579
|
+
out.append(f"Cartesia · plano {c['plan']} · cota mensal")
|
|
580
|
+
out.append(
|
|
581
|
+
f" usado {_n(c['used'])} / {_n(c['quota'])} créditos ({round(c['fraction'] * 100)}%) · "
|
|
582
|
+
f"{SOURCE_LABEL.get(c['source'], c['source'])}" + (f", lido em {_local(c['read_at'])}" if c["read_at"] else "")
|
|
583
|
+
)
|
|
584
|
+
out.append(f" restante {_n(c['remaining'])}")
|
|
585
|
+
out.append(f" no ciclo {_lines(c['cycle']['lines'])} · {_n(c['cycle']['chars'])} caracteres gerados aqui")
|
|
586
|
+
out.append("")
|
|
587
|
+
out.append(f"VoiceStudio · local · {_lines(v['lines'])}, {_n(v['audio_s'])} s de áudio")
|
|
588
|
+
if r["by_video"]:
|
|
589
|
+
out += ["", "por vídeo (ciclo)"]
|
|
590
|
+
for p in r["by_video"]:
|
|
591
|
+
spent = []
|
|
592
|
+
if p["fish_usd"]:
|
|
593
|
+
spent.append(f"Fish ~US$ {p['fish_usd']:.4f}")
|
|
594
|
+
if p["cartesia_credits"]:
|
|
595
|
+
spent.append(f"Cartesia {_n(p['cartesia_credits'])} créditos")
|
|
596
|
+
out.append(f" {p['video']:<40} {p['lines']:>3} fala(s) {', '.join(spent) or 'local'}")
|
|
597
|
+
for w in r["warnings"]:
|
|
598
|
+
out.append(f"⚠ {w}")
|
|
599
|
+
for e in r["refresh"]["errors"]:
|
|
600
|
+
out.append(f"· {e}")
|
|
601
|
+
return "\n".join(out)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
def main():
|
|
605
|
+
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
606
|
+
ap.add_argument("command", nargs="?", default="summary", choices=["summary", "events", "keys"])
|
|
607
|
+
ap.add_argument("--json", action="store_true")
|
|
608
|
+
ap.add_argument("--live", action="store_true", help="pergunta às plataformas agora")
|
|
609
|
+
ap.add_argument("--n", type=int, default=30)
|
|
610
|
+
a = ap.parse_args()
|
|
611
|
+
if a.command == "events":
|
|
612
|
+
for e in events()[-a.n :]:
|
|
613
|
+
print(json.dumps(e, ensure_ascii=False))
|
|
614
|
+
elif a.command == "keys":
|
|
615
|
+
names = {
|
|
616
|
+
CFG["voice"]["fish"]["key_env"]: bool(fish_key()),
|
|
617
|
+
CFG["voice"]["cartesia"]["key_env"]: bool(cartesia_key()),
|
|
618
|
+
cfg()["cartesia"]["admin_key_env"]: bool(cartesia_admin_key()),
|
|
619
|
+
}
|
|
620
|
+
for k, ok in names.items():
|
|
621
|
+
print(f"{'✓' if ok else '·'} {k}{'' if ok else ' (vazia)'}")
|
|
622
|
+
else:
|
|
623
|
+
r = summary(live=a.live)
|
|
624
|
+
print(json.dumps(r, ensure_ascii=False) if a.json else text(r))
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
if __name__ == "__main__":
|
|
628
|
+
main()
|