Skip to main content

One doc tagged with "react-native"

View All Tags

Add CloudBase AI (DeepSeek / Hunyuan) to a React Native App

RN 0.74+ mobile apps use a two-stage 'frontend fetch + backend proxy' pattern: a backend Route Handler (Next.js / Cloud Function / Cloud Run, your choice) uses @cloudbase/node-sdk's app.ai().createModel('cloudbase').streamText({model: 'deepseek-v4-flash'}) to return a text/plain streaming Response; the RN frontend reads the stream with fetch + body.getReader() (or react-native-fetch-api polyfill / XHR onprogress fallback) and renders text character by character in a FlatList. SecretId / SecretKey must never appear in the JS bundle — RN bundles are plaintext and can be decompiled by anyone.