# BrainLink Integration Examples
Source: https://docs.brainlink.dev/developers/examples
# BrainLink - OAuth AI provider.
Source: https://docs.brainlink.dev/developers/oauth
Learn how to use OAuth in your AI application to allow users to connect AI providers like OpenAI, Anthropic, Gemini, and more with one click.
# BrainLink OAuth
At BrainLink we use a secure OAuth workflow to provide your application with users' access and refresh tokens which you can use to run inference on their behalf via our model proxy.
BrainLink supports 300+ models through an OpenAI-compatible API, which means your code needs minimal changes.
OpenAI, Anthropic, Gemini, and other AI providers do not support a "Sign In with OpenAI" like functionality. Thus, BrainLink creates a layer on top of
them to help applications get more users by reducing the onboarding friction.
To get started integrating BrainLink on your AI application go to the [Quickstart guide](/developers/quickstart).
## Shortcuts
Go to the Brainlink Dashboard
Check out the BrainLink user experience in our live demo
# BrainLink Developer Quickstart
Source: https://docs.brainlink.dev/developers/quickstart
Integrate BrainLink and list your app in the AI store in 5 minutes.
## BrainLink Developer Docs
Integrating BrainLink in your app allows your users to connect their brains with a single click.
This allows you to get rid of the inference costs and provides your app with a simple way to monetize without paywalls or sign-up forms.
By integrating BrainLink your app is automatically listed in the BraiLink AI store, which is a powerful distribution channel and source of users.
We are devs building for fellow devs.
### Integrating BrainLink
> If your are still testing your app and have no public URL, skip the registration and use `5e476497-d7a1-4d27-8ad3-616210cf754d` as the app client ID. The user will be redirected to `http://localhost:3000` as callback URL.
1. Create your own BrainLink account by going to the [dashboard](https://www.brainlink.dev/dashboard).
2. Click on the top right menu icon and click on "Register application" under the developer section.
3. Fill the form with your application data. If you application is a desktop app, the callback URL should point to localhost.
For the callback URL, if you don't plan to redirect the user to a specific page after connecting their account, just provide the base URL of the application.
In most of the cases, it matches the application website URL.
4. Copy the application client ID that is shown after the registration.
If you are using React based frameworks like Next.js, you can directly import the BrainLink button:
```javascript theme={null}
import * as BrainLink from "@brainlink/spa-sdk";
import BrainLinkButton from "@brainlink/react-button";
...
// Use the button on your app
...
// Get the user access token to run inference (see next section)
const userAccessToken = await BrainLink.getUserToken();
```
To see complete examples for different frameworks see our [examples repository](https://github.com/miguelaeh/brainlink-examples).
You can also import the BrainLink SDK script directly:
```html theme={null}
```
Then, create a button and set as the `on-click` attribute the `BrainLink.startCodeExchange(appClientId, appCallbackUrl);` method.
The application client ID must be the one you generated in the previous step and the callback URL is optional. You just need to provide a callback URL if you want
the user to be redirected to a different page after connecting his BrainLink account, otherwise, it will remain on the same page.
And that's all! Now your users will pay for the inference they consume by connecting their BrainLink account with your application in one click, so you don't have
to request them API keys.
### Running inference
BrainLink's API is fully OpenAI compatible, so you can directly use the OpenAI SDK or any other compatible one, just change the `baseURL` to `https://www.brainlink.dev/api/v1`.
For example:
```javascript theme={null}
if (BrainLink.isConnected()) {
const userAccessToken = await BrainLink.getUserToken();
const openai = new OpenAI({
baseURL: "https://www.brainlink.dev/api/v1",
apiKey: userAccessToken,
// Required to use the OpenAI SDK in the browser.
// Since your app is securely using the user's access token via BrainLink, it's totally safe to use the SDK on the browser.
dangerouslyAllowBrowser: true,
});
}
const completion = await openai?.chat.completions.create({
model: "google/gemini-2.0-flash-lite-preview-02-05:free",
messages: messages,
});
```
## Shortcuts
Go to the Brainlink Dashboard
Check out the BrainLink user experience in our live demo
# BrainLink Supported Models
Source: https://docs.brainlink.dev/developers/supported-models
# Introduction - BrainLink AI app store
Source: https://docs.brainlink.dev/introduction
Welcome to the BrainLink Documentation site
## What's BrainLink
BrainLink is an AI app store where you can find applications, agents, and tools.
Every user has a portable account - a brain - that can be linked to any app with a single click. These brains automatically provide the apps with user-paid inference, identity, monetization, memory, etc.
As a user, you can decide which parts of your brain to connect to each app as well as track data and spending across apps.
AI apps have high variable inference costs, which makes it challenging for developers, especially indie developers, to publish free or inexpensive apps.
Implementing monthly subscriptions adds high friction and the Bring Your Own Key (BYOK) approach has security issues, limits the development flexibility, and is not user friendly.
At BrainLink, we believe AI should be like electricity. When you get a new app you just plug your brain and pay for the computation you consume, while the app can
monetize by adding some markup to your consumption or charging you per task completed or executed.
**Our mission is to make this process a single click for users and trivial to implement for developers.**
Browse applications in the BrainLink AI store
Create your Brain to enjoy all the benefits
Try the BrainLink demo to learn how simple it is to connect your Brain to an app
Integrate BrainLink and list your app in the BrainLink AI store