r/iOSProgramming • • Jun 25 '26

Question As solo developer how do you implement AI features into your app?

Hi,

Wondering what are the options if I want to create an AI features into in my app. I know about openAI api and other various API’s. The thing is I am a tad scared to use them because I hardly understand how they charge. I know a lot of stories where people used it wrongly and got huge bills for that.

Also, do we always need these powerful models? Can’t we use in some cases like qwen 8b or something like that running on a VPS?

15 Upvotes

69 comments sorted by

View all comments

24

u/yacec Jun 25 '26

Have you considered on-device models like https://developer.apple.com/documentation/foundationmodels ?

8

u/stoccolma Jun 25 '26

On-device is the only sane way to do it unless it is something extremely crazy and niché

1

u/command-shift Jun 25 '26

I've been using Gemini 2.5 Flash, but I don't need a frontier model for what I'm doing and I didn't know about this. Thanks!!!

1

u/Inside-Conclusion435 Jun 25 '26

Wait gemini 2.5 flash in Apple Intelligence?

1

u/command-shift Jun 25 '26

No. My app calls out to a Supabase function that relays that call to Gemini Flash for a response. I wasn’t aware of on-device models. Gemini Flash is super cheap and sufficient for what I do

1

u/Inside-Conclusion435 Jun 25 '26

What provider u use? Google AI studio?

1

u/mmmm_frietjes Jun 25 '26

The Apple on device models currently suck. Not sure about iOS 27. Haven’t looked into it yet.
But I wanna point out that there’s probably a local model that works better than 2.5 Flash.
New api from WWDC is Core AI and currently we already have MLX. https://huggingface.co/mlx-community

2

u/command-shift Jun 25 '26

I mean, Gemini 2.5 Flash also “sucks”, but all I need my model for is simple processing of time and dates from natural language. I’d imagine the on-device models are sufficient for this, and I can remove an external dependency if so…

1

u/mmmm_frietjes Jun 25 '26

Ah yeah, sounds like something foundation models can do. Current context is only 4k tokens though. So larger text needs to be split up.

1

u/jacobs-tech-tavern Jun 27 '26

Even Apple's private cloud compute only has a 32K token context window. Outside extremely specialized models you're going to get not that good results.

-2

u/Inside-Conclusion435 Jun 25 '26

Hmm, no, I heard about it but I was told it is pretty rubbish. I will look into it. So each user will run its own instance of AI on their phones and that will sort out the AI requirements of the app?

4

u/m1_weaboo Jun 25 '26

it is not rubbish.

it also has api to check if the inference is available (e.g. if they have turned on apple intelligence, if the model is fully downloaded)

1

u/Inside-Conclusion435 Jun 25 '26

So if user doesn’t have it on, it will pop up a modal asking to download it? I hope many of them hit download and not cancel. What models they have available btw, new deal with Google probably will bring around Gemini? Also what about older phones? What if user’ phone does not support apple intelligence? Basically if I decide to go this path I should aim users with the latest IOS version and onwards?

4

u/m1_weaboo Jun 25 '26

>> 1. If the user does not have Apple Intelligence turned on, Will it pop up a modal asking to download?

No. Not out of the box. And it is intentional by design.

You would check the availability by the SystemLanguageModel.default.availabilty API:

// An example from Apple Documentation

struct GenerativeView: View {
    // Create a reference to the system language model.
    private var model = SystemLanguageModel.default


    var body: some View {
        switch model.availability {
        case .available:
            // Show your intelligence UI.
        case .unavailable(.deviceNotEligible):
            // Show an alternative UI.
        case .unavailable(.appleIntelligenceNotEnabled):
            // Ask the person to turn on Apple Intelligence.
        case .unavailable(.modelNotReady):
            // The model isn't ready because it's downloading or because of other system reasons.
        case .unavailable(let other):
            // The model is unavailable for an unknown reason.
        }
    }
}

And you handle each cases by yourself.

>> 2. What models they have available btw, new deal with Google probably will bring around Gemini?

It is Apple Foundation Model (AFM), trained by Apple, using outputs from Google's foundation model that's used to build Gemini Model.

>> 3. Also what about older phones? What if user' phone does not support apple intelligence?

As mentioned before, There is model availability API.

If the phone does not support Apple Intelligence, You can still provide such feature by using 3rd party local LLM of your choice. There're Swift packages on the internet to pick, that can help you ship the feature.

Or use server-model by making request to an endpoint in your backend (which then make request to 3rd party mode providers) that requires authentication. This works with any devices with internet connection.

---

Additionally, To make sure your code is future-proof,

In OS27 and later, You can make use of the new LanguageModel protocol.

It serves as a unified abstraction layer that bridges any LLM (Local or Server-side) with LanguageModelSession. It allows you to integrate local LLM models, or external cloud models.

---

>> 4. Should I aim users with the latest iOS version and onwards?

Totally depend. It's a product decision.

Apple Intelligence is supported in these released iPhones:

  • iPhone 15 Pro and Pro Max (iOS 18.1 and later)
  • iPhone 16, iPhone 16 Plus, iPhone 16 Pro and Pro Max (iOS 18.1 and later)
  • iPhone 17, iPhone Air, iPhone 17 Pro and Pro Max (shipped with iOS26)