Translate where the conversation happens.
A native iOS keyboard with translation previews, undo, and your choice of AI provider.
Overview · Getting started · Architecture · Development · Privacy
Keyboard Live brings AI translation into apps that support third-party iOS keyboards. Write a message, select a passage or place the cursor after a paragraph, then review the translation before inserting it. Bring your own provider account and API key.
The companion app uses a monochrome interface with three focused areas:
| Screen | Purpose |
|---|---|
| Translate | Try a translation, switch or swap languages, choose a communication style, and inspect the result. |
| Keyboard | Follow setup instructions and configure preview, automatic capitalization, and double-space period. |
| Settings | Manage your provider, API key, model, and interface language. |
- Translation in place — selected text or the visible paragraph before the cursor.
- Review before inserting — preview with Insert and Cancel, or optional direct replacement.
- Restore the original — one-step undo while the translated text and cursor remain unchanged.
- Four AI providers — separate credentials and model configuration for Groq, OpenAI, Gemini, and Claude.
- Two communication styles — natural casual chat or respectful formal wording.
- Four languages — English QWERTY, French AZERTY, Russian, and Ukrainian, with localized app text.
- Familiar typing controls — Shift/Caps Lock, automatic capitals that follow the host field’s capitalization mode, double-space period, and hold-to-delete.
- Accent menus — long-press options including
é è ê ë,à â æ,ô œ,ё ъ, andґ. - Stale-result protection — cancel or reject work after relevant text, cursor, field, settings, or keyboard-session changes.
| Requirement | Details |
|---|---|
| Device | iPhone or iPad running iOS 17 or later |
| Development | Xcode 16 or later; Swift 5.9 or later for core tests |
| Translation | Your API key and a model available to your provider account |
| Keyboard networking | Allow Full Access in iOS Settings |
Ordinary typing works without Full Access. Some apps and secure fields do not allow third-party keyboards.
git clone https://github.com/Zapotichnyi06/Keyboard-Live.git
cd Keyboard-Live
open 'Keyboard - Live.xcodeproj'- Select the Keyboard - Live scheme and your iPhone or an installed iOS simulator.
- For device installation, select your signing team for both targets.
- Configure the matching App Group and shared Keychain capabilities. If you change identifiers, update both entitlement files and
Shared/AppConfiguration.swifttogether. - Build and launch the app.
- Open the app's Settings tab and choose a provider.
- Enter and save your API key. The key stays in the shared iOS Keychain.
- If needed, enter a model ID under Advanced. An empty field uses that provider's configured default.
- Open Translate, choose the languages and style, enter sample text, and tap Translate.
A saved-key status confirms local storage; it does not verify provider access. Translation requests may incur provider charges. Model availability depends on your account and can change; defaults are defined in Shared/AppConfiguration.swift.
- Go to iOS Settings → General → Keyboard → Keyboards → Add New Keyboard.
- Add Keyboard - Live and enable Allow Full Access for AI translation.
- Open an app that supports custom keyboards and switch to Keyboard Live with the globe button.
- Write or select text, tap Translate, and review the preview before inserting it.
The app's Settings shortcut opens its system Settings page. Keyboard installation and Full Access still require the system steps above.
| Symptom | Next step |
|---|---|
| Keyboard Live is missing from the globe menu | Add Keyboard - Live in iOS Settings using the steps above. For a development install, build and launch the companion app first. |
| The system keyboard appears in a password or another protected field | iOS or the host app can restrict third-party keyboards in that field. Use the system keyboard there. |
| Typing works, but keyboard translation cannot connect | Enable Allow Full Access for Keyboard - Live and confirm that the device has a network connection. |
| An API key is saved, but translation fails | Confirm the selected provider and model. A saved key only confirms local storage; check the provider account's API access and usage limits. Try sample text in the app's Translate tab to see whether the same request fails there. |
| Only part of a long paragraph is translated | The host app may expose limited context. Select the intended passage explicitly and review the preview. Requests are limited to 4,000 characters. |
| Restore original is unavailable | Undo requires unchanged text and cursor context in the same keyboard session. After editing or moving the cursor, the previous undo record may no longer be eligible. |
For a reproducible issue, note whether it occurs in the companion app, keyboard extension, or both. Include the host app, iOS version, selected languages, provider/model, and a short non-private sample. Never include an API key or a private conversation in an issue or screenshot.
| Provider | API integration | Configuration |
|---|---|---|
| Groq | Chat Completions | API key + model ID |
| OpenAI | Responses, with store: false |
API key + model ID |
| Gemini | Generate Content | API key + model ID |
| Claude | Messages | API key + model ID |
Instructions and source text are sent in separate API fields or messages. Adapters accept completed text responses and reject incomplete output. Provider errors are mapped to localized messages rather than displayed as raw response bodies.
The project contains a SwiftUI companion app, a UIKit keyboard extension, and a shared core. Both Xcode targets compile the same shared source. A dependency-free Swift package tests that core directly.
flowchart TD
App["Companion app · SwiftUI"] --> Preferences["Shared settings and Keychain"]
Keyboard["Keyboard extension · UIKit"] --> Preferences
Keyboard --> Editor["Document context, edit and undo guards"]
App --> Coordinator["Translation coordinator"]
Keyboard --> Coordinator
Coordinator --> Service["Validation and HTTP transport"]
Service --> Adapters["Groq · OpenAI · Gemini · Claude"]
| Layer | Main files | Responsibility |
|---|---|---|
| App UI | LiveTranslateKeyboardApp/ContentView.swift |
Translation, keyboard setup, and connection settings |
| App state | LiveTranslateKeyboardApp/SettingsViewModel.swift |
Preferences, credential actions, and sample-request state |
| Keyboard | KeyboardExtension/KeyboardViewController.swift, KeyboardView.swift |
Input actions, lifecycle, key layout, and styling |
| Host document | KeyboardExtension/ProxyDocument.swift, Shared/DocumentEditing.swift |
Context matching, actual edit sequence, and undo eligibility |
| Preview | KeyboardExtension/TranslationPreviewView.swift |
Original/result presentation and insert/cancel actions |
| Request lifecycle | Shared/TranslationCoordinator.swift |
Cancellation and suppression of stale completions |
| Networking | Shared/TranslationService.swift, *TranslationAdapter.swift |
Reusable ephemeral transport, typed errors, and provider formats |
| Persistence | Shared/SettingsStore.swift, SharedKeychain.swift, CredentialStore.swift |
Shared preferences, legacy compatibility, and update-first key storage |
| Language and copy | Shared/TranslationModels.swift, KeyboardLayout.swift, *Copy.swift |
Languages, styles, layouts, and localized text |
Each translation captures the host field's identifier, visible surrounding context, and selection. Before inserting a result, the editor checks that the snapshot still matches. An undo record is kept in memory only while the post-translation context is unchanged and the complete inserted result remains visible to iOS's text proxy.
Requests are not automatically retried or sent to another provider. Cancellation suppresses late results; it cannot guarantee that a provider stops processing or charging for a request it has already received.
Run core tests without real API credentials or network requests:
swift testBuild both iOS targets without signing:
xcodebuild -project 'Keyboard - Live.xcodeproj' \
-scheme 'Keyboard - Live' -configuration Debug \
-destination 'generic/platform=iOS Simulator' \
CODE_SIGNING_ALLOWED=NO buildGitHub Actions runs the tests and an unsigned simulator build for pushes to main and pull requests.
Tests exercise document and selection guards, actual edit/restore sequences with Unicode text, typing rules, settings migration, Keychain write failures, all four provider formats, HTTP failures, and cancellation races. They use local fixtures and test doubles.
Device checks remain necessary for host-app behavior, shared credentials, Full Access, long-press menus, layout, and accessibility. A successful build or fixture test does not establish live translation quality.
- Text is sent directly to your selected provider only after a translation action. That provider's data policies and account settings apply.
- API keys are stored in the shared iOS Keychain. Updating a key does not delete the old item before attempting to save the replacement.
- The app creates no translation history, text logs, or automatic clipboard copies. Preview, undo, and sample results are held in memory.
- iOS controls the document context exposed to the keyboard. Long text may be truncated before the keyboard receives it. Select a passage and review the preview when precise scope matters.
- Translation is limited to 4,000 characters per request. Models can reach their output limits sooner; incomplete output is rejected.
- Restore original is unavailable after relevant text or cursor changes, in a new keyboard session, or when iOS cannot expose the whole inserted result.
Use the bug report or feature request templates. For bugs, include reproduction steps, device/iOS version, host app, and relevant language/provider settings. Use sample text and omit credentials and private conversations.
Pull requests should describe the resulting behavior and the checks actually run. Include relevant core tests for changes to editing, cancellation, provider parsing, or persistence.
Copyright 2026 Roman Zapotichnyi. Licensed under the Apache License, Version 2.0. See NOTICE for attribution.
Apple text document proxy · Groq API · OpenAI Responses · Gemini Generate Content · Claude Messages