Ollama allow you to self-host quickly large language models.
Our SDKs include automatic integrations with Ollama.
1
Setup the SDK
Python
Learn how to set up the Python SDK.
Javascript
Learn how to set up the JavaScript SDK.
2
Monitor Ollama
With our SDKs, tracking Ollama calls is super simple.
Python
Javascript
from openai import OpenAIimport lunaryclient = OpenAI(base_url='http://localhost:11434/v1/', # replace by your Ollama base urlapi_key='ollama', #required but ignored)lunary.monitor(client)chat_completion = client.chat.completions.create(messages=[{'role': 'user','content': 'Say this is a test',}], model='llama3.2',)
import OpenAI from 'openai'import { monitorOpenAI } from "lunary/openai"const openai = monitorOpenAI(new OpenAI({ baseURL: 'http://localhost:11434/v1/', // replace by your Ollama base url apiKey: 'ollama', // required but ignored}))const chatCompletion = await openai.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'llama3.2',})
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Lunary Documentation","colors":{"primary":"#099DFF","light":"#099DFF","dark":"#099DFF"},"logo":{"light":"https://mintcdn.com/lunary/jh1i7dZRvqbDfvzx/logo/light.svg?fit=max\u0026auto=format\u0026n=jh1i7dZRvqbDfvzx\u0026q=85\u0026s=d6a08adeee6c4e0a7c731580a97d6df0","dark":"https://mintcdn.com/lunary/vczTtzy07XKKcaZn/logo/dark.svg?fit=max\u0026auto=format\u0026n=vczTtzy07XKKcaZn\u0026q=85\u0026s=3921447bb20dbecef5efafe052f6bcf8"},"favicon":"https://mintcdn.com/lunary/vczTtzy07XKKcaZn/favicon.png?fit=max\u0026auto=format\u0026n=vczTtzy07XKKcaZn\u0026q=85\u0026s=b5002548a2fae8564b7071262518e535","api":{"openapi":{"source":"https://api.lunary.ai/v1/openapi","directory":"api"},"playground":{"display":"interactive","proxy":false},"examples":{"languages":["bash"]}},"navbar":{"links":[{"href":"mailto:support@lunary.ai","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.lunary.ai"}},"integrations":{"intercom":{"appId":"pv95fmzm"}},"contextual":{"options":["copy","chatgpt","claude","mcp","add-mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lunary","hasAudioNarration":false,"actualSubdomain":"lunary","customDomains":["docs.lunary.ai"],"gitSource":{"type":"github","owner":"lunary-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6aecb506dab9b27b2441ef0a","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"API Reference","count":95},{"language":"default","tag":"Documentation","count":49},{"language":"default","tag":"Integrations","count":30},{"language":"default","tag":"Datasets v2","count":20},{"language":"default","tag":"Datasets","count":13},{"language":"default","tag":"Evals","count":12},{"language":"default","tag":"Runs","count":11},{"language":"default","tag":"Features","count":9},{"language":"default","tag":"Javascript","count":9},{"language":"default","tag":"More","count":8}]},"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":"llms-txt-v2","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":"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}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"integrations/ollama","slug":"/integrations/ollama","pageMetadata":{"title":"Ollama Integration","sidebarTitle":"Ollama","icon":"sheep","description":null,"href":"/integrations/ollama"},"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={code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{Card,CardGroup,CodeBlock,Step,Steps,Tab,Tabs}=_components;if(!Card)_missingMdxReference(`Card`,true);if(!CardGroup)_missingMdxReference(`CardGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Ollama allow you to self-host quickly large language models.\nOur SDKs include automatic integrations with Ollama.`}),`\n`,_jsxs(Steps,{children:[_jsx(Step,{n:`1`,title:`Setup the SDK`,children:_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Python`,icon:`python`,href:`/integrations/python/installation`,children:_jsx(_components.p,{children:`Learn how to set up the Python SDK.`})}),_jsx(Card,{title:`Javascript`,icon:`js`,href:`/integrations/javascript/installation`,children:_jsx(_components.p,{children:`Learn how to set up the JavaScript SDK.`})})]})}),_jsxs(Step,{n:`2`,title:`Monitor Ollama`,children:[_jsx(_components.p,{children:`With our SDKs, tracking Ollama calls is super simple.`}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`Python`,icon:`python`,id:`python`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`20`,language:`python`,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:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`20`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` lunary`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`base_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'http://localhost:11434/v1/'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# replace by your Ollama base url`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'ollama'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`#required but ignored`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`lunary.monitor(client)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`chat_completion `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.chat.completions.create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'role'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Say this is a test'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'llama3.2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})})}),_jsx(Tab,{title:`Javascript`,id:`javascript`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'openai'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`monitorOpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"lunary/openai\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` openai`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` monitorOpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenAI`}),_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\":`#9CDCFE`},children:` baseURL:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'http://localhost:11434/v1/'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// replace by your Ollama base url`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'ollama'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// required but ignored`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}))`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` chatCompletion`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openai`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_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\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Say this is a test'`}),_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\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'llama3.2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})})})]})]})]})]})}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":"Ollama Integration","sidebarTitle":"Ollama","icon":"sheep","description":null,"href":"/integrations/ollama"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"subdomain":"lunary","siteName":"Lunary Documentation","title":"Ollama Integration - Lunary Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-05T16:55:49.174Z","originalFileLocation":"integrations/ollama.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=\"application-name\" content=\"Lunary Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lunary/jbNpZOyPceF1vtc9/_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/lunary/jbNpZOyPceF1vtc9/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lunary/jbNpZOyPceF1vtc9/_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/lunary/jbNpZOyPceF1vtc9/_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/lunary/jbNpZOyPceF1vtc9/_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/lunary/jbNpZOyPceF1vtc9/_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/lunary/jbNpZOyPceF1vtc9/_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/lunary/jbNpZOyPceF1vtc9/_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/lunary/jbNpZOyPceF1vtc9/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Ollama Integration - Lunary Documentation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Lunary Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.lunary.ai/integrations/ollama\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lunary.mintlify.site/_mintlify/api/og/v2?division=Integrations\u0026amp;title=Ollama+Integration\u0026amp;theme=19884c910dee32aefdf3bbb8\u0026amp;signature=661def868fb66a45abec3433916808bfd3cf315a649f6fbb803264843e84e0ec\">\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=\"Ollama Integration - Lunary Documentation\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lunary.mintlify.site/_mintlify/api/og/v2?division=Integrations\u0026amp;title=Ollama+Integration\u0026amp;theme=19884c910dee32aefdf3bbb8\u0026amp;signature=661def868fb66a45abec3433916808bfd3cf315a649f6fbb803264843e84e0ec\">\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/lunary/jbNpZOyPceF1vtc9/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Lunary Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#099DFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.lunary.ai/integrations/ollama\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/integrations/ollama.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.lunary.ai/#organization\",\"name\":\"Lunary Documentation\",\"url\":\"https://docs.lunary.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lunary/jh1i7dZRvqbDfvzx/logo/light.svg?fit=max\u0026auto=format\u0026n=jh1i7dZRvqbDfvzx\u0026q=85\u0026s=d6a08adeee6c4e0a7c731580a97d6df0\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.lunary.ai#website\",\"name\":\"Lunary Documentation\",\"url\":\"https://docs.lunary.ai\",\"publisher\":{\"@id\":\"https://docs.lunary.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.lunary.ai/integrations/ollama#webpage\",\"url\":\"https://docs.lunary.ai/integrations/ollama\",\"name\":\"Ollama Integration\",\"dateModified\":\"2026-11-05T16:55:49.174Z\",\"isPartOf\":{\"@id\":\"https://docs.lunary.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.lunary.ai/integrations/ollama#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.lunary.ai/integrations/ollama#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Integrations\",\"item\":\"https://docs.lunary.ai/integrations/python/installation\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ollama Integration\",\"item\":\"https://docs.lunary.ai/integrations/ollama\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.lunary.ai/integrations/ollama#article\",\"headline\":\"Ollama Integration\",\"name\":\"Ollama Integration\",\"url\":\"https://docs.lunary.ai/integrations/ollama\",\"mainEntityOfPage\":{\"@id\":\"https://docs.lunary.ai/integrations/ollama#webpage\"},\"dateModified\":\"2026-11-05T16:55:49.174Z\",\"publisher\":{\"@id\":\"https://docs.lunary.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.lunary.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Lunary Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Lunary Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/integrations/ollama.md","siteName":"Lunary Documentation","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Get started","pages":[{"title":"Introduction","icon":"rocket","href":"/get-started"},{"title":"Docs MCP","sidebarTitle":"Docs MCP","icon":"https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/modelcontextprotocol.svg","href":"/get-started/docs-mcp"}]},{"group":"Integrations","pages":[{"group":"Python","icon":"python","pages":[{"title":"Python SDK Installation","sidebarTitle":"Installation","href":"/integrations/python/installation"},{"title":"Python OpenAI integration","sidebarTitle":"OpenAI","href":"/integrations/python/openai"},{"title":"Python Anthropic integration","sidebarTitle":"Anthropic","href":"/integrations/python/anthropic"},{"title":"Python Azure OpenAI integration","sidebarTitle":"Azure OpenAI","href":"/integrations/python/azure-openai"},{"title":"Manual Usage","href":"/integrations/python/manual"},{"title":"Python SDK logging and troubleshooting","sidebarTitle":"Logging and troubleshooting","icon":"bug","href":"/integrations/python/logging"},{"title":"Python SDK Reference","sidebarTitle":"Reference","href":"/integrations/python/reference"}]},{"group":"Javascript","icon":"js","pages":[{"title":"JavaScript SDK","sidebarTitle":"Installation","href":"/integrations/javascript/installation"},{"title":"JS OpenAI integration","sidebarTitle":"OpenAI","href":"/integrations/javascript/openai"},{"title":"JavaScript Anthropic integration","sidebarTitle":"Anthropic","href":"/integrations/javascript/anthropic"},{"title":"JS Azure OpenAI integration","sidebarTitle":"Azure OpenAI","href":"/integrations/javascript/azure-openai"},{"title":"Usage with React","sidebarTitle":"React","href":"/integrations/javascript/react"},{"title":"Custom Models","href":"/integrations/javascript/custom-model"},{"title":"Manual Usage","href":"/integrations/javascript/manual"},{"title":"Serverless","href":"/integrations/javascript/serverless"},{"title":"Vercel AI SDK","sidebarTitle":"Vercel AI SDK","href":"/integrations/javascript/vercel-ai-sdk"}]},{"group":"OpenTelemetry","icon":"telescope","pages":[{"title":"Observability via OpenTelemetry","sidebarTitle":"Overview","href":"/integrations/opentelemetry/overview"},{"title":"Sending OTEL Traces from Python","sidebarTitle":"OTEL Python","href":"/integrations/opentelemetry/otel-python"},{"title":"OpenTelemetry (OTEL) Mapping","sidebarTitle":"OTEL Mapping","href":"/integrations/opentelemetry/otel-mapping"}]},{"title":"OpenAI integration","sidebarTitle":"OpenAI","icon":"https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/openai.svg","href":"/integrations/openai"},{"title":"Azure OpenAI integration","sidebarTitle":"Azure OpenAI","icon":"https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/microsoftazure.svg","href":"/integrations/azure-openai"},{"title":"Mistral integration","sidebarTitle":"Mistral","icon":"https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/mistral.svg","href":"/integrations/mistral"},{"title":"LangChain Integration","sidebarTitle":"Langchain","icon":"link","href":"/integrations/langchain"},{"title":"Pydantic AI Integration","sidebarTitle":"Pydantic AI","icon":"robot","description":null,"href":"/integrations/pydantic-ai"},{"title":"Ollama Integration","sidebarTitle":"Ollama","icon":"sheep","href":"/integrations/ollama"},{"title":"LiteLLM Integration","sidebarTitle":"LiteLLM","icon":"van-shuttle","description":null,"href":"/integrations/litellm"},{"title":"IBM WatsonX Integration","sidebarTitle":"IBM WatsonX","icon":"box","href":"/integrations/ibm"},{"title":"TrueFoundry integration","sidebarTitle":"TrueFoundry","icon":"network-wired","href":"/integrations/truefoundry"},{"title":"Flowise Integration","sidebarTitle":"Flowise","icon":"wave-sine","href":"/integrations/flowise"},{"title":"Step-by-Step Guide : Sending Events via the Lunary API","sidebarTitle":"Custom","icon":"uncharted","href":"/integrations/custom"}]},{"group":"Features","pages":[{"title":"Observability","icon":"chart-area","href":"/features/observability"},{"title":"Product Analytics","sidebarTitle":"Product Analytics","icon":"chart-area","href":"/features/product-analytics"},{"title":"Chats \u0026 Threads","sidebarTitle":"Conversations","icon":"messages","href":"/features/conversations"},{"title":"Prompt Templates","sidebarTitle":"Prompt","icon":"brackets-curly","href":"/features/prompts"},{"title":"Prompt Playground","sidebarTitle":"Playground","icon":"play","href":"/features/prompt-playground"},{"title":"Classification","icon":"tags","href":"/features/classification"},{"title":"Tagging","icon":"tags","href":"/features/tags"},{"title":"User Tracking","sidebarTitle":"Users","icon":"users","href":"/features/users"},{"title":"Feedback Tracking","sidebarTitle":"Feedback","icon":"flag","href":"/features/feedback"}]},{"group":"More","pages":[{"group":"Security","icon":"shield","pages":[{"title":"Data Security","sidebarTitle":"Introduction","href":"/more/security/introduction"},{"title":"CCPA compliance guide","sidebarTitle":"CCPA","href":"/more/security/CCPA"},{"title":"GDPR compliance guide","sidebarTitle":"GDPR","href":"/more/security/GDPR"}]},{"title":"Concepts","icon":"circle-info","href":"/more/concepts"},{"title":"BigQuery Connector","href":"/more/data-warehouse/bigquery"},{"group":"Self-Hosting","icon":"database","pages":[{"title":"Docker","icon":"docker","href":"/more/self-hosting/docker"},{"title":"Docker Compose","icon":"dolphin","href":"/more/self-hosting/docker-compose"},{"title":"Kubernetes","icon":"container-storage","href":"/more/self-hosting/kubernetes"}]}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api/introduction"}]}]},"basePath":"","title":"Ollama Integration - Lunary Documentation","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":[],"chunks":[]}