https://github.com/proxymanapp/gptclientapp
Demonstrate how to capture open api endpoint with Proxyman
https://github.com/proxymanapp/gptclientapp
Last synced: 11 months ago
JSON representation
Demonstrate how to capture open api endpoint with Proxyman
- Host: GitHub
- URL: https://github.com/proxymanapp/gptclientapp
- Owner: ProxymanApp
- Created: 2025-06-16T14:41:55.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-16T14:42:13.000Z (about 1 year ago)
- Last Synced: 2025-07-29T00:48:49.011Z (11 months ago)
- Language: Swift
- Size: 9.77 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GPT Chat App
A simple iOS chat application built with SwiftUI that integrates with OpenAI's GPT-4 API using Server-Side Events for real-time streaming responses.
## Features
- 🎨 **iMessage-style chat bubbles** - Beautiful, rounded chat bubbles with proper alignment
- 📱 **Native iOS interface** - Clean, modern UI that feels native to iOS
- ⚡ **Real-time streaming** - Uses Server-Side Events for smooth, real-time GPT responses
- 🎯 **Smart scrolling** - Auto-scrolls to show new messages with smooth animations
- ⌨️ **Keyboard-friendly** - Responsive text input with proper keyboard handling
## Setup Instructions
1. **Get your OpenAI API Key**
- Go to [OpenAI Platform](https://platform.openai.com/api-keys)
- Create a new API key
- Copy the key
2. **Configure the app**
- Open `GPTClientApp/Config.swift`
- Replace `"YOUR_API_KEY_HERE"` with your actual OpenAI API key:
```swift
static let openAIAPIKey = "sk-your-actual-api-key-here"
```
3. **Build and Run**
- Open the project in Xcode
- Select your target device or simulator
- Press `Cmd + R` to build and run
## Architecture
The app is structured with the following components:
- **`ChatMessage`** - Data model for chat messages
- **`ChatBubbleView`** - SwiftUI view for individual chat bubbles
- **`OpenAIService`** - Service class handling OpenAI API communication with SSE
- **`ContentView`** - Main chat interface with message list and input field
- **`Config`** - Configuration constants including API key
## Requirements
- iOS 14.0+
- Xcode 12.0+
- Valid OpenAI API key with GPT-4 access
## Usage
1. Launch the app
2. Type your message in the text field at the bottom
3. Tap the send button (paper plane icon)
4. Watch as GPT-4 responds in real-time with streaming text
5. Continue the conversation!
## API Usage
The app uses OpenAI's Chat Completions API with the following configuration:
- Model: `gpt-4`
- Streaming: Enabled (Server-Side Events)
- Max tokens: 1500
## Security Note
Make sure to keep your API key secure and never commit it to version control. Consider using environment variables or secure keychain storage for production apps.