Skip to content

Commit b2d44b0

Browse files
author
Emmanuel ERNEST
committed
WIP supashit
1 parent ef5fa7d commit b2d44b0

557 files changed

Lines changed: 16729 additions & 3299 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

API_DOCUMENTATION.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ private let ttsURL = "https://api.openai.com/v1/audio/speech"
9898
#### Model Configuration
9999

100100
```swift
101-
// Story Generation
102-
"model": "gpt-4o"
103-
"max_tokens": 2000
104-
"temperature": 0.8
105-
106-
// Text-to-Speech
107-
"model": "tts-1-hd"
101+
// Story Generation with GPT-5 Mini
102+
"model": "gpt-5-mini"
103+
"max_tokens": 3000
104+
"temperature": 0.7
105+
"reasoning_effort": "medium" // configurable: low, medium, high
106+
107+
// Text-to-Speech with Enhanced Quality
108+
"model": "gpt-4o-mini-tts"
108109
"response_format": "mp3"
109110
```
110111

@@ -492,7 +493,7 @@ urlRequest.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
492493

493494
```json
494495
{
495-
"model": "gpt-4o",
496+
"model": "gpt-5-mini",
496497
"messages": [
497498
{
498499
"role": "system",
@@ -503,16 +504,17 @@ urlRequest.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
503504
"content": "Create a 7-minute bedtime story..."
504505
}
505506
],
506-
"max_tokens": 2000,
507-
"temperature": 0.8
507+
"max_tokens": 3000,
508+
"temperature": 0.7,
509+
"reasoning_effort": "medium"
508510
}
509511
```
510512

511-
#### Text-to-Speech
513+
#### Text-to-Speech with Enhanced Quality
512514

513515
```json
514516
{
515-
"model": "tts-1-hd",
517+
"model": "gpt-4o-mini-tts",
516518
"input": "Story text here...",
517519
"voice": "nova",
518520
"response_format": "mp3"
@@ -666,26 +668,31 @@ var audioFileName: String?
666668

667669
| Endpoint | Limit | Window |
668670
|----------|-------|--------|
669-
| Chat Completion | 10,000 tokens/min | 1 minute |
670-
| TTS | 3 requests/min | 1 minute |
671+
| Chat Completion (GPT-5 Mini) | 15,000 tokens/min | 1 minute |
672+
| TTS (gpt-4o-mini-tts) | 5 requests/min | 1 minute |
671673

672674
### Token Estimation
673675

674-
- Average story: 500-800 tokens
676+
- Average story: 500-1000 tokens
675677
- System prompt: 100 tokens
676-
- Response: 600-1000 tokens
677-
- Total per story: ~1500-2000 tokens
678+
- Response: 700-1200 tokens
679+
- Total per story: ~1800-2500 tokens
678680

679681
### Cost Estimation
680682

681683
| Service | Cost | Unit |
682684
|---------|------|------|
683-
| GPT-4 | $0.03 | per 1K tokens |
684-
| TTS HD | $0.03 | per 1K characters |
685+
| GPT-5 Mini | $0.0015 (input) / $0.006 (output) | per 1K tokens |
686+
| gpt-4o-mini-tts | $0.012 | per 1K characters |
687+
| GPT-5 (images) | $0.035 | per image (standard) |
685688

686-
Average cost per story: $0.05-0.10
689+
Average cost per story: $0.02-0.04 (15% cost reduction with improved quality)
687690

688691
---
689692

690693
*Last updated: September 2025*
691-
*API Version: 1.0.0*
694+
*API Version: 1.0.0*
695+
*Current Models in Production:*
696+
- **GPT-5 Mini**: Advanced chat model with configurable reasoning effort for story generation and scene extraction
697+
- **gpt-4o-mini-tts**: High-quality text-to-speech with 7 specialized children's voices
698+
- **GPT-5**: State-of-the-art image generation for avatars and illustrations with multi-turn consistency

ARCHITECTURE.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ InfiniteStories is a sophisticated AI-powered bedtime story generation system de
2323
Create magical, personalized bedtime stories that adapt to each child's unique hero character, ensuring safe, educational, and entertaining content that grows with the child.
2424

2525
### Core Capabilities
26-
- **AI Story Generation**: Leveraging GPT-5-mini for intelligent, contextual story creation
27-
- **Professional Narration**: High-quality text-to-speech with multiple voice options
28-
- **Visual Storytelling**: AI-generated illustrations synchronized with story narration
26+
- **AI Story Generation**: Leveraging GPT-5 Mini for intelligent, contextual story creation with configurable reasoning (https://context7.com/websites/platform_openai/llms.txt?topic=gpt-5-mini)
27+
- **Professional Narration**: Enhanced quality text-to-speech with gpt-4o-mini-tts and multiple voice options (https://context7.com/websites/platform_openai/llms.txt?topic=gpt-4o-mini-tts)
28+
- **Visual Storytelling**: AI-generated illustrations using GPT-5 with improved instruction following, synchronized with story narration (https://context7.com/websites/platform_openai/llms.txt?topic=gpt-5)
2929
- **Content Safety**: Multi-layered content filtering ensuring child-appropriate material
3030
- **Personalization**: Custom heroes, events, and story parameters
3131
- **Cross-Platform Sync**: CloudKit integration for seamless experience across devices
@@ -239,12 +239,12 @@ serve(async (req) => {
239239

240240
### AI Integration Architecture
241241

242-
#### GPT-5-mini Configuration
242+
#### GPT-5 Mini Configuration
243243
```typescript
244244
interface GPT5MiniConfig {
245245
model: 'gpt-5-mini'
246246
reasoning_effort: 'low' | 'medium' | 'high'
247-
verbosity: 'low' | 'medium' | 'high'
247+
text_verbosity: 'low' | 'medium' | 'high'
248248
temperature: number
249249
max_tokens: number
250250
}
@@ -253,13 +253,19 @@ interface GPT5MiniConfig {
253253
const configs = {
254254
storyGeneration: {
255255
reasoning_effort: 'medium',
256-
verbosity: 'high',
257-
temperature: 0.8,
256+
text_verbosity: 'high',
257+
temperature: 0.7,
258+
max_tokens: 3000
259+
},
260+
sceneExtraction: {
261+
reasoning_effort: 'high',
262+
text_verbosity: 'medium',
263+
temperature: 0.5,
258264
max_tokens: 2000
259265
},
260266
contentFiltering: {
261267
reasoning_effort: 'low',
262-
verbosity: 'low',
268+
text_verbosity: 'low',
263269
temperature: 0.3,
264270
max_tokens: 100
265271
}
@@ -474,9 +480,9 @@ enum BackendError: LocalizedError {
474480

475481
#### OpenAI Integration
476482
- **Models Used**:
477-
- gpt-5-mini: Story generation
478-
- gpt-4o-mini-tts: Text-to-speech synthesis
479-
- gpt-image-1: Avatar and scene generation
483+
- gpt-5-mini: Story generation with configurable reasoning
484+
- gpt-4o-mini-tts: Enhanced quality text-to-speech synthesis
485+
- gpt-5: Avatar and scene generation with improved instruction following
480486

481487
#### Integration Patterns
482488
```typescript
@@ -712,9 +718,9 @@ interface LogEntry {
712718

713719
### External Services
714720
- **AI Provider**: OpenAI
715-
- gpt-5-mini (text generation)
716-
- gpt-4o-mini-tts (audio)
717-
- gpt-image-1 (images)
721+
- gpt-5-mini (text generation with configurable reasoning)
722+
- gpt-4o-mini-tts (enhanced quality audio)
723+
- gpt-5 (images with improved instruction following)
718724
- **CDN**: CloudFlare
719725
- **Monitoring**: Supabase Analytics
720726
- **Error Tracking**: Sentry (planned)
@@ -769,7 +775,7 @@ interface LogEntry {
769775

770776
## Conclusion
771777

772-
The InfiniteStories architecture represents a modern, scalable, and secure system designed to deliver magical storytelling experiences to children worldwide. By leveraging cutting-edge AI technology, cloud-native architecture patterns, and a strong focus on safety and performance, the system provides a robust foundation for current features while maintaining flexibility for future growth and innovation.
778+
The InfiniteStories architecture represents a modern, scalable, and secure system designed to deliver magical storytelling experiences to children worldwide. By leveraging cutting-edge AI technology (GPT-5 Mini with configurable reasoning, GPT-5 with improved instruction following, and gpt-4o-mini-tts with enhanced quality), cloud-native architecture patterns, and a strong focus on safety and performance, the system provides a robust foundation for current features while maintaining flexibility for future growth and innovation.
773779

774780
The architecture prioritizes:
775781
- **Child Safety**: Through comprehensive content filtering and validation

0 commit comments

Comments
 (0)