Anthropic React Native Client
backmesh/anthropic-react-native
Cliente Anthropic para React Native com streaming nativo SSE
Ver no GitHubCliente nativo para React Native que permite chamar a API Anthropic/Claude diretamente de aplicações mobile, sem polyfills. Suporta streaming com Server-Sent Events e mantém compatibilidade de tipos com o SDK Node.js da Anthropic.
Instalação
npx convez-ai backmesh/anthropic-react-native1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Integrar Claude em aplicativos React Native
- Implementar chat com streaming em tempo real em mobile
- Chamar API Anthropic através de proxy backend seguro
Veredito

Solução prática para integrar Claude em apps React Native, com ênfase correta em segurança (proxy obrigatório). Comunidade ativa e exemplo funcional com Backmesh. Recomendado para quem precisa de IA em produção mobile.
README
A tradução para o português deste README ainda está na fila.
Anthropic React Native Client
The goal of this library is to use React Native SSE instead of polyfills to support calling the Anthropic API directly from React Native with streaming. The package uses the same types and API as the Anthropic Node SDK wherever possible.
[!CAUTION] You should never expose any secrets in the bundle of a web or mobile app. The correct usage of this client package is with a backend that proxies the Anthropic call while making sure access is secured. The
baseURLparameter for this Anthropic client is thus mandatory. If you set the baseURL to https://api.anthropic.com/v1, you are basically exposing your Anthropic API key on the internet! This example in this repo uses Backmesh.
Contributions and Feature Requests
If you would like to contribute or request a feature, please join our Discord and ask questions in the #oss channel or create a pull request or issue.
Setup
Install the package
npm i anthropic-react-native
And then instantiate the client:
import Anthropic from 'anthropic-react-native';
const client = new Anthropic({
baseURL:
'https://edge.backmesh.com/v1/proxy/PyHU4LvcdsQ4gm2xeniAFhMyuDl2/yWo35DdTROVMT52N0qs4/',
// The backmesh proxy uses your auth provider's JWT to authorize access
apiKey: supabase.auth.session().access_token,
});
Usage
The streaming APIs uses an EventSource from react-native-sse under the hood to provide a required typed event callbacks for each of the Anthropic API Types.
client.messages.stream(
{
model: 'claude-3-5-sonnet-20240620',
messages: [{ role: 'user', content: userInput }],
max_tokens: 1024,
},
{
onError: (error) => {
console.error('SSE Error:', error); // Handle any errors here
},
onMessageStart: () => {
setUserInput('');
},
onContentBlockDelta: (ev: ContentBlockDeltaEvent) => {
if (ev.delta.type === 'text_delta')
setText((prevText) => prevText + (ev.delta as TextDelta).text);
},
onMessageStop: () => {
console.log('SSE connection for completion closed.'); // Handle when the connection is opened
},
}
);
Check the example for more details
Coverage
License
MIT