Host your own Dari Link with the self-hosted gateway.
The self-hosted gateway serves Dari Link out of the box: the popup, the tokens, and the model endpoints.
Required Settings
export DARI_GATEWAY_KEYS=$(openssl rand -hex 24) # your admin keyexport DARI_GATEWAY_ENCRYPTION_KEY=$(openssl rand -base64 32) # encrypts users' logins and keysexport DARI_LINK_SESSION_SECRET=$(openssl rand -hex 32) # signs the cookie that remembers usersexport DARI_GATEWAY_DB=/data/dari-gateway.db
Without DARI_GATEWAY_ENCRYPTION_KEY, the popup refuses to store anyone’s subscription or key. Keep it in a secret manager: lose it and every stored connection is unreadable.
Rotate The Encryption Key
Put the new key first, keep the old one after it, and restart once:
Routing state (hashes, model choices, token counts)
—
Prompts and responses
Not stored
Users have no Dari account. A signed, HttpOnly cookie remembers what they connected, for a year, and lets them manage it at /v1/link/connections.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Dari","colors":{"primary":"#16A34A","light":"#07C983","dark":"#15803D"},"logo":{"light":"https://mintcdn.com/dari-f8f4d32a/yoz83kEl00ItQyBj/logo/light.svg?fit=max\u0026auto=format\u0026n=yoz83kEl00ItQyBj\u0026q=85\u0026s=63bbd7a20548840714b1eb0687023c4b","dark":"https://mintcdn.com/dari-f8f4d32a/L2V1wjhblZujodTN/logo/dark.svg?fit=max\u0026auto=format\u0026n=L2V1wjhblZujodTN\u0026q=85\u0026s=51ca4e20f6745d93c286a5ae15632dfe"},"favicon":"https://mintcdn.com/dari-f8f4d32a/L2V1wjhblZujodTN/favicon.svg?fit=max\u0026auto=format\u0026n=L2V1wjhblZujodTN\u0026q=85\u0026s=0d610013404459b8a8cd9550c293769a","styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"dari-f8f4d32a","hasAudioNarration":false,"actualSubdomain":"dari-f8f4d32a","customDomains":["docs.dari.dev"],"gitSource":{"type":"github","owner":"mupt-ai","repo":"dari-mono","deployBranch":"docs-prod","contentDirectory":"dari-docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6b01fc3819dd0559bf373c1b","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"default","tag":"Documentation","count":61},{"language":"default","tag":"Developers","count":27},{"language":"default","tag":"API Reference","count":16},{"language":"default","tag":"Activity","count":14},{"language":"default","tag":"Routers","count":14},{"language":"default","tag":"Dari Link","count":12},{"language":"default","tag":"Router Framework","count":11},{"language":"default","tag":"Self-Hosted Gateway","count":10},{"language":"default","tag":"Management API","count":9},{"language":"default","tag":"Guides","count":7}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"link/run-a-gateway","slug":"/link/run-a-gateway","pageMetadata":{"title":"Run A Gateway","description":"Host your own Dari Link with the self-hosted gateway.","icon":"server","href":"/link/run-a-gateway"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Host your own Dari Link with the self-hosted gateway.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The `,_jsx(_components.a,{href:`/gateway/self-hosting`,children:`self-hosted gateway`}),` serves Dari Link out of the box: the popup, the tokens, and the model endpoints.`]}),`\n`,_jsx(Heading,{level:`2`,id:`required-settings`,children:`Required Settings`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` DARI_GATEWAY_KEYS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -hex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 24`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# your admin key`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` DARI_GATEWAY_ENCRYPTION_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -base64`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# encrypts users' logins and keys`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` DARI_LINK_SESSION_SECRET`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -hex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# signs the cookie that remembers users`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` DARI_GATEWAY_DB`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`dari-gateway`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`db`})]}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Without `,_jsx(_components.code,{children:`DARI_GATEWAY_ENCRYPTION_KEY`}),`, the popup refuses to store anyone’s subscription or key. Keep it in a secret manager: lose it and every stored connection is unreadable.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`rotate-the-encryption-key`,children:`Rotate The Encryption Key`}),`\n`,_jsx(_components.p,{children:`Put the new key first, keep the old one after it, and restart once:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` DARI_GATEWAY_ENCRYPTION_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$NEW_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`,`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$OLD_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`On start, the gateway re-encrypts everything with the new key. Then you can drop the old one.`}),`\n`,_jsx(Heading,{level:`2`,id:`allow-http-redirects-in-development`,children:`Allow http Redirects In Development`}),`\n`,_jsxs(_components.p,{children:[`In `,_jsx(_components.code,{children:`dari-gateway.yaml`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`yaml`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`yaml`,children:_jsxs(_components.code,{language:`yaml`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`link`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:` allowHttpRedirectHosts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` - `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"*.example.ts.net\"`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`what-it-stores`,children:`What It Stores`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Stored`}),_jsx(_components.th,{children:`Encrypted`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Users’ subscription logins and API keys`}),_jsx(_components.td,{children:`Yes (AES-256-GCM)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Apps and connections`}),_jsx(_components.td,{children:`—`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Routing state (hashes, model choices, token counts)`}),_jsx(_components.td,{children:`—`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Prompts and responses`}),_jsx(_components.td,{children:_jsx(_components.strong,{children:`Not stored`})})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Users have no Dari account. A signed, HttpOnly cookie remembers what they connected, for a year, and lets them manage it at `,_jsx(_components.code,{children:`/v1/link/connections`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Run A Gateway","description":"Host your own Dari Link with the self-hosted gateway.","icon":"server","href":"/link/run-a-gateway"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Required Settings","slug":"required-settings","depth":2,"children":[]},{"title":"Rotate The Encryption Key","slug":"rotate-the-encryption-key","depth":2,"children":[]},{"title":"Allow http Redirects In Development","slug":"allow-http-redirects-in-development","depth":2,"children":[]},{"title":"What It Stores","slug":"what-it-stores","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"dari-f8f4d32a","siteName":"Dari","title":"Run A Gateway - Dari","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-16T19:51:14.486Z","originalFileLocation":"link/run-a-gateway.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Host your own Dari Link with the self-hosted gateway.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Dari\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Run A Gateway - Dari\">\u003cmeta data-mint-head property=\"og:description\" content=\"Host your own Dari Link with the self-hosted gateway.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Dari\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.dari.dev/link/run-a-gateway\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://dari-f8f4d32a.mintlify.site/_mintlify/api/og/v2?division=Guides\u0026amp;title=Run+A+Gateway\u0026amp;description=Host+your+own+Dari+Link+with+the+self-hosted+gateway.\u0026amp;theme=1d97d3f7c0ca6efe709d5869\u0026amp;signature=34dd0685e6310edb451479e434a3cfb70b84585487c2125934f3674a932f9b37\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Run A Gateway - Dari\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Host your own Dari Link with the self-hosted gateway.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://dari-f8f4d32a.mintlify.site/_mintlify/api/og/v2?division=Guides\u0026amp;title=Run+A+Gateway\u0026amp;description=Host+your+own+Dari+Link+with+the+self-hosted+gateway.\u0026amp;theme=1d97d3f7c0ca6efe709d5869\u0026amp;signature=34dd0685e6310edb451479e434a3cfb70b84585487c2125934f3674a932f9b37\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/dari-f8f4d32a/x9qXFrf1KQro95Iw/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Dari\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#16A34A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.dari.dev/link/run-a-gateway\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/link/run-a-gateway.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.dari.dev/#organization\",\"name\":\"Dari\",\"url\":\"https://docs.dari.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/dari-f8f4d32a/yoz83kEl00ItQyBj/logo/light.svg?fit=max\u0026auto=format\u0026n=yoz83kEl00ItQyBj\u0026q=85\u0026s=63bbd7a20548840714b1eb0687023c4b\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.dari.dev#website\",\"name\":\"Dari\",\"url\":\"https://docs.dari.dev\",\"publisher\":{\"@id\":\"https://docs.dari.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.dari.dev/link/run-a-gateway#webpage\",\"url\":\"https://docs.dari.dev/link/run-a-gateway\",\"name\":\"Run A Gateway\",\"description\":\"Host your own Dari Link with the self-hosted gateway.\",\"dateModified\":\"2026-11-16T19:51:14.486Z\",\"isPartOf\":{\"@id\":\"https://docs.dari.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.dari.dev/link/run-a-gateway#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.dari.dev/link/run-a-gateway#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Dari Link\",\"item\":\"https://docs.dari.dev/link/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Guides\",\"item\":\"https://docs.dari.dev/link/what-users-can-connect\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Run A Gateway\",\"item\":\"https://docs.dari.dev/link/run-a-gateway\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.dari.dev/link/run-a-gateway#article\",\"headline\":\"Run A Gateway\",\"name\":\"Run A Gateway\",\"description\":\"Host your own Dari Link with the self-hosted gateway.\",\"url\":\"https://docs.dari.dev/link/run-a-gateway\",\"mainEntityOfPage\":{\"@id\":\"https://docs.dari.dev/link/run-a-gateway#webpage\"},\"dateModified\":\"2026-11-16T19:51:14.486Z\",\"publisher\":{\"@id\":\"https://docs.dari.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.dari.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Dari\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Dari\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/link/run-a-gateway.md","siteName":"Dari","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Dari Overview","icon":"house","href":""},{"title":"Quickstart","icon":"bolt","href":"/quickstart"},{"title":"Install the Dari CLI","icon":"terminal","href":"/install-cli"}]},{"group":"Coding Agents","pages":[{"title":"Claude Code","icon":"terminal","href":"/router/coding-agents/claude-code"},{"title":"Codex","icon":"terminal","href":"/router/coding-agents/codex"},{"title":"OpenCode","icon":"terminal","href":"/router/coding-agents/opencode"},{"title":"Pi","icon":"terminal","href":"/router/coding-agents/pi"},{"title":"Muse Code","icon":"terminal","href":"/router/coding-agents/muse-code"},{"title":"OpenClaw","icon":"terminal","href":"/router/coding-agents/openclaw"},{"title":"Hermes Agent","icon":"terminal","href":"/router/coding-agents/hermes"}]},{"group":"Routers","pages":[{"title":"Subscriptions And API Keys","icon":"key","href":"/router/configure-provider-keys"},{"title":"Routers","icon":"route","href":"/router/overview"},{"group":"Activity","icon":"chart-line","root":{"title":"Activity Overview","icon":"chart-line","href":"/router/model-activity"},"pages":[{"title":"Models \u0026 Routing","icon":"route","href":"/router/model-activity/models-routing"},{"title":"People \u0026 Keys","icon":"users","href":"/router/model-activity/people-keys"},{"title":"Conversations","icon":"message-lines","href":"/router/model-activity/conversations"},{"title":"Pull Requests","icon":"code-pull-request","href":"/router/model-activity/pull-requests"},{"title":"Tools \u0026 Skills","icon":"wrench","href":"/router/model-activity/tools-and-skills"}]},{"group":"Advanced","icon":"sliders","pages":[{"title":"Router YAML","icon":"file-code","href":"/router/create-a-router"},{"title":"Cloud Providers","icon":"cloud","href":"/router/cloud-providers"},{"title":"Router Evals","icon":"trophy","href":"/evals/overview"},{"title":"Speculative Routing","icon":"arrows-split-up-and-left","href":"/router/speculative-routing"},{"title":"Session Pinning","icon":"thumbtack","href":"/router/session-pinning"},{"title":"Context Limits","href":"/routing/context-limits"}]}]},{"group":"Dari Link","pages":[{"title":"Link Overview","icon":"link","href":"/link/overview"},{"title":"Quickstart","icon":"rocket","href":"/link/quickstart"},{"title":"Link Web SDK","icon":"code","href":"/link/web"},{"group":"Guides","icon":"book-open","pages":[{"title":"What Users Can Connect","icon":"plug","href":"/link/what-users-can-connect"},{"title":"Call Models","icon":"message","href":"/link/call-models"},{"title":"Manage Connections","icon":"sliders","href":"/link/manage-connections"},{"title":"Sandboxes And Workers","icon":"box","href":"/link/sandboxes"},{"title":"Usage And Budgets","icon":"chart-simple","href":"/link/usage-and-budgets"},{"title":"Test Your Integration","description":"Run your tests against a real gateway on stand-in plans.","icon":"flask","href":"/link/test-your-integration"},{"title":"Run A Gateway","icon":"server","href":"/link/run-a-gateway"}]}]},{"group":"Developers","pages":[{"title":"API Quickstart","description":"Send your first request through Dari's default model router.","icon":"bolt","href":"/router/quickstart"},{"title":"API Keys","icon":"key","href":"/api-keys"},{"title":"Authentication","icon":"user-lock","href":"/authentication"},{"group":"Send Requests","icon":"paper-plane","pages":[{"title":"Chat Completions API","icon":"comment-dots","href":"/router/send-chat-completions"},{"title":"OpenAI Responses API","icon":"comments","href":"/router/send-responses"},{"title":"Anthropic Messages API","icon":"comment","href":"/router/send-anthropic-messages"}]},{"group":"Self-Hosted Gateway","icon":"server","root":{"title":"Self-Hosted Gateway","icon":"server","href":"/gateway/self-hosting"},"pages":[{"title":"Quickstart","icon":"rocket","href":"/gateway/quickstart"},{"title":"Configure Routers","icon":"sliders","href":"/gateway/configure-routers"},{"title":"Provider Keys","icon":"key","href":"/gateway/provider-keys"},{"title":"Subscriptions","icon":"id-card","href":"/gateway/subscriptions"},{"title":"Models","icon":"brain","href":"/gateway/models"},{"title":"Coding Agents","icon":"terminal","href":"/gateway/coding-agents"},{"title":"HTTP API","icon":"plug","href":"/gateway/api"},{"title":"Operations","icon":"gear","href":"/gateway/operations"},{"title":"Embed The Runtime","icon":"cube","href":"/gateway/embedding"}]},{"group":"Router Framework","icon":"code","root":{"title":"Router Framework","icon":"route","href":"/framework/overview"},"pages":[{"title":"Quickstart","icon":"bolt","href":"/framework/quickstart"},{"title":"Models","icon":"cube","href":"/framework/models"},{"title":"Policies","icon":"brain","href":"/framework/policies"},{"title":"Custom Executors","icon":"code","href":"/framework/custom-executors"},{"title":"Protocols And Streaming","icon":"signal","href":"/framework/protocols-and-streaming"},{"title":"Prompt Caching","icon":"database","href":"/framework/prompt-caching"},{"title":"Auto Router","icon":"sparkles","href":"/framework/auto-router"},{"title":"Operations","icon":"gear","href":"/framework/operations"},{"title":"Speculative Routing","icon":"arrows-split-up-and-left","href":"/framework/speculative-routing"},{"title":"Decision Pipeline","icon":"book","href":"/framework/decision-pipeline"}]}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/router/overview"}]}]},"basePath":"","title":"Run A Gateway - Dari","deploymentId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","buildId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","dynamics":[],"chunks":[]}