Introduction To Link
Dari Link is the client-side component that your users interact with to connect their AI subscriptions and API keys to your app. Once a user connects, your app makes model requests on what they shared. You never see their credentials, and you don’t pay for their usage. An example Link flow. Your user’s exact flow may differ.1
The user clicks Connect with Dari
A small popup opens.
2
Signs in with Dari
With Google or an email link. On hosted Dari this is their Dari account, so anything they already connected there is ready to share.
3
Picks what to connect
A subscription (ChatGPT, Claude, OpenCode Go, Meta Muse) or an API key (OpenAI, Anthropic, OpenRouter, and more).
4
Signs in to that provider
The same sign-in they already know.
5
And allows your app
The popup closes. Your app is connected.
Link Supported Platforms
Initializing Link
Link is opened with your app’sclient_id, which you get by registering your app. There is nothing to create on your server before opening it. For details, see the Quickstart and the Link Web SDK.
Link Flow Overview
Link gives your app a temporarycode, which your server exchanges for a permanent refresh_token.
The Link flow begins when your user wants to connect their AI subscription to your app.
1
Call
DariLink.open to open Link for your user. When they allow your app, Link provides a temporary code.2
Call
/v1/link/token to exchange the code for a permanent refresh_token and grant_id for the new connection.3
Store the
refresh_token. It is the only thing your app keeps for the connection.4
Use the
refresh_token to make model requests on what your user connected.- On the frontend:
DariLink.openresolves with thecodeonce the user allows your app. - On the backend: your server sends the
codeto/v1/link/token, stores therefresh_tokenit gets back, and uses it for every later call.
What Link Handles
Dari checks each of these on every request, so your app does not build them.What Users Can Connect
Users connect ChatGPT, Claude, OpenCode Go, and Meta Muse subscriptions, and API keys for model providers and gateways. Some plans serve any app, and some only their vendor’s own coding agent. To learn more, see What Users Can Connect.Error-Handling Flows
Your user can change what they shared with your app without connecting again. This is called update mode. For more information, see Manage Connections. A user can disconnect your app from Dari at any time. Your next call for that connection answers401 grant_revoked, and your app should offer to connect again. For information on handling this flow, see Manage Connections.
A code is single-use and expires 10 minutes after Link provides it. Exchange it as soon as your app receives it.
Sandboxes And Workers
If your app runs agents in sandboxes, give each one a short-lived child token that serves only the models it needs, instead of your user’s own token. To learn more, see Sandboxes And Workers.Usage And Budgets
Dari records what every request of a connection used, and your app reads it back by its own tags. Your user can also cap what your app may use. To learn more, see Usage And Budgets.Testing
The stub gateway is the real gateway on stand-in plans, so your tests run the whole flow without a subscription or a paid call. To learn more, see Test Your Integration.Hosted Or Self-Hosted
Point your app at hosted Dari (https://routing.dari.dev), or run the self-hosted gateway for your own users. Both serve the same Link and the same rules. On hosted Dari, users sign in with their Dari account, and their plans are that account’s. A self-hosted gateway has no accounts: a user’s first plan makes their connection, and their browser remembers it.
Users see and manage what they connected at /v1/link/connections on the same host. Conversations are not stored. Dari keeps only routing data.