-
Notifications
You must be signed in to change notification settings - Fork 0
Advanced Topics Bring Your Own Ai
Using your own AI service does not create a separate device workflow. Device connection, AI request events, the SCO or Opus audio path selected by the device, session coordination, and cleanup continue to follow the corresponding AIBuds feature documentation.
The integration difference is authentication and AI processing: the host app authenticates its own service, reports that result to the device, and uses its own AI implementation instead of an SDK-provided AI service.
Self-owned AI authorization handoff
Authenticate the app's AI service, report the result to the device, and then continue the standard device-driven AI flow.
- Connect the Device — Establish the normal AIBuds device connection and wait until the required feature APIs are ready.
- Authenticate Your AI Service — The host app completes authentication using its own service integration.
- Report the Result — Send true when the service is ready, or false when authentication fails or the service is unavailable.
- Continue the Standard Flow — The device can continue eligible AI requests and the documented SCO or Opus audio flow after a successful report.
- Process with Your AI — Handle the AI request with the app\
The host app owns authentication for its AI service and the AI-specific request processing. After each authentication attempt, it reports the current result through reportSelfAiServiceAuthResult.
The AIBuds device workflow does not need to be replaced. Continue to use the documented device events, requested audio channel, feature lifecycle, stop handling, and cleanup for AI Chat, AI Audio Recording, Streaming ASR, Simultaneous Interpretation, or the feature being implemented.
For example, when the device requests Opus input, it can send the voice stream only after the self-owned AI service is authorized and the successful result has been reported. When the device requests SCO, the app continues to prepare the documented SCO recording path. Using your own AI service does not change which side selects the audio channel.
func selfAIAuthenticationDidFinish(isAuthenticated: Bool) {
guard let serviceAuthAPI = device as? DeviceServiceAuthAPI else { return }
// Report only the result. Authentication is completed by the host app.
serviceAuthAPI.reportSelfAiServiceAuthResult(isAuthenticated) {
reportSucceeded,
error in
guard reportSucceeded else {
print(error?.localizedDescription ?? "Failed to report authorization")
return
}
// A true result allows the device to continue eligible AI flows.
// A false result keeps the device informed that the service is unavailable.
}
}- (void)selfAIAuthenticationDidFinish:(BOOL)isAuthenticated {
if (![self.device conformsToProtocol:@protocol(AIBudsDeviceServiceAuthAPI)]) {
return;
}
id<AIBudsDeviceServiceAuthAPI> serviceAuthAPI =
(id<AIBudsDeviceServiceAuthAPI>)self.device;
// Report only the result. Authentication is completed by the host app.
[serviceAuthAPI reportSelfAiServiceAuthResult:isAuthenticated
completion:^(BOOL reportSucceeded,
NSError *error) {
if (!reportSucceeded) {
NSLog(@"%@", error.localizedDescription);
return;
}
// A true result allows the device to continue eligible AI flows.
// A false result keeps the device informed that the service is unavailable.
}];
}See reportSelfAiServiceAuthResult and Report Self-AI Authorization for the complete API contract.
Completion semantics
The completion handler reports whether the Boolean result was delivered to the device. It does not indicate whether the host app successfully authenticated the AI service. Do not send tokens, API keys, or other credentials through this API.
- Authenticate the self-owned AI service in the host app.
- Report
trueonly when that service is ready for AI requests. - Report
falseafter authentication failure or when the service is unavailable. - Continue the documented device event, SCO or Opus, session, and cleanup flow for the selected AI feature.
- Keep credentials inside the app's own secure service integration; report only the Boolean result to the device.
AIBuds SDK documentation · Full documentation · API Reference
- Introduction
- Getting Started
- Core Concepts
-
Core Features
- Basic Features
- Device Info
- Find Device
- Physical Operations
- Work Mode
- Work Status
- Wear Detection
- Volume Control
- Music Control
- TWS
- Equalizer
- ANC
- Audio
- Camera
- Remote Camera
- File Import
- Teleprompter
- Segment Navigation
- Live Streaming
- Device Applications
- OTA
- Camera OTA
- Service Auth
- AI Services
- Voice Assistant
- Logging
- Advanced Topics
- Releases
- Troubleshooting