{"id":28208974,"url":"https://github.com/candlefinance/react-native-openai","last_synced_at":"2025-06-12T09:31:09.935Z","repository":{"id":200803141,"uuid":"683764662","full_name":"candlefinance/react-native-openai","owner":"candlefinance","description":"OpenAI API Native bindings for React Native","archived":false,"fork":false,"pushed_at":"2024-11-02T14:51:16.000Z","size":610,"stargazers_count":123,"open_issues_count":6,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-17T15:13:08.696Z","etag":null,"topics":["ios","kotlin","ktor","lightweight","openai","react-native","swift","urlsession"],"latest_commit_sha":null,"homepage":"https://candle.fi","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/candlefinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-27T16:22:56.000Z","updated_at":"2025-05-02T05:51:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb5d020d-c5af-4ec1-9a08-a5bdf600e590","html_url":"https://github.com/candlefinance/react-native-openai","commit_stats":null,"previous_names":["candlefinance/react-native-openai"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/candlefinance/react-native-openai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candlefinance%2Freact-native-openai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candlefinance%2Freact-native-openai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candlefinance%2Freact-native-openai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candlefinance%2Freact-native-openai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/candlefinance","download_url":"https://codeload.github.com/candlefinance/react-native-openai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candlefinance%2Freact-native-openai/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259438602,"owners_count":22857551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","kotlin","ktor","lightweight","openai","react-native","swift","urlsession"],"created_at":"2025-05-17T15:13:04.538Z","updated_at":"2025-06-12T09:31:09.927Z","avatar_url":"https://github.com/candlefinance.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"https://github.com/candlefinance/react-native-openai/assets/12258850/44a496dc-68bc-44ee-9224-07c302121e94\n\n\u003cbr/\u003e\n\u003cdiv align=\"center\"\u003e\n \u003ca href=\"https://www.npmjs.com/package/react-native-openai\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dm/react-native-openai\" alt=\"npm downloads\" /\u003e\n\u003c/a\u003e\n  \u003ca alt=\"discord users online\" href=\"https://discord.gg/qnAgjxhg6n\" \n  target=\"_blank\"\n  rel=\"noopener noreferrer\"\u003e\n    \u003cimg alt=\"discord users online\" src=\"https://img.shields.io/discord/986610142768406548?label=Discord\u0026logo=discord\u0026logoColor=white\u0026cacheSeconds=3600\"/\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003ch1 align=\"center\"\u003e\n OpenAI for React Native\n\u003c/h1\u003e\n\n\u003cbr/\u003e\n\nThe goal is to make this library take advantage of the native APIs like URLSession and Android's Ktor engine for better performance and reliability.\n\nIf you would like to contribute, please join our [Discord](https://discord.gg/qnAgjxhg6n) and ask questions in the **#oss** channel or create a pull request.\n\n## Features\n\n- [x] [Chat](https://platform.openai.com/docs/api-reference/chat)\n- [ ] [Models](https://beta.openai.com/docs/api-reference/models)\n- [ ] [Completions](https://beta.openai.com/docs/api-reference/completions)\n- [ ] [Edits](https://beta.openai.com/docs/api-reference/edits)\n- [x] [Images](https://beta.openai.com/docs/api-reference/images)\n- [ ] [Embeddings](https://beta.openai.com/docs/api-reference/embeddings)\n- [ ] [Files](https://beta.openai.com/docs/api-reference/files)\n- [ ] [Moderations](https://beta.openai.com/docs/api-reference/moderations)\n- [ ] [Fine-tunes](https://beta.openai.com/docs/api-reference/fine-tunes)\n- [ ] [Speech to text](https://platform.openai.com/docs/guides/speech-to-text)\n- [ ] [Function calling](https://platform.openai.com/docs/guides/gpt/function-calling)\n\n## Installation\n\nRequires `iOS 15+` and Android `minSdkVersion = 24`.\n\n```sh\nyarn add react-native-openai\n```\n\n### Basic Usage\n\n```js\nimport OpenAI from 'react-native-openai';\n\nconst openAI = new OpenAI({\n  apiKey: 'YOUR_API_KEY',\n  organization: 'YOUR_ORGANIZATION',\n});\n\n// Alternatively (recommended), you can use your own backend and not hardcode an API key in your app i.e. https://my-custom-domain.com/v1/chat/completions (follow the same API as OpenAI until pathPrefix is fixed on Android)\nconst openAI = new OpenAI({\n  host: 'my-custom-host.com',\n});\n```\n\n### Chat API\n\n```js\nconst [result, setResult] = React.useState('');\n\n// Listen for messages\nopenAI.chat.addListener('onChatMessageReceived', (payload) =\u003e {\n  setResult((message) =\u003e {\n    const newMessage = payload.choices[0]?.delta.content;\n    if (newMessage) {\n      return message + newMessage;\n    }\n    return message;\n  });\n});\n\n// Send a message\nopenAI.chat.stream({\n  messages: [\n    {\n      role: 'user',\n      content: 'How do I star a repo?',\n    },\n  ],\n  model: 'gpt-3.5-turbo',\n});\n\n// Alternatively, you can use the create method if `stream` is false\nawait openAI.chat.create(...)\n```\n\n### Image API\n\n```js\nconst result = await openAI.image.create({\n  prompt: 'An awesome Candle logo',\n  n: 3,\n  size: '512x512',\n});\n\nsetImages(result.data.map((image) =\u003e image.url));\n```\n\n## Credit\n\nThank you to Dylan Shine \u0026 Mouaad Aallam for making [openai-kit](https://github.com/dylanshine/openai-kit) and [openai-kotlin](https://github.com/aallam/openai-kotlin) which this library is based on.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcandlefinance%2Freact-native-openai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcandlefinance%2Freact-native-openai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcandlefinance%2Freact-native-openai/lists"}