### Install Ollama via Script Source: https://docs.ollama.com/linux Use the official install script for a quick setup. This command can also be used to update existing installations. ```shell curl -fsSL https://ollama.com/install.sh | sh ``` -------------------------------- ### Install Ollama Libraries Source: https://docs.ollama.com/cloud Install the necessary client libraries for Python or JavaScript. ```bash pip install ollama ``` ```bash npm i ollama ``` -------------------------------- ### Manual Pi Installation and Configuration Source: https://docs.ollama.com/integrations/pi Steps for manual installation and setting up provider models and default settings. ```bash npm install -g @earendil-works/pi-coding-agent ``` ```json { "providers": { "ollama": { "baseUrl": "http://localhost:11434/v1", "api": "openai-completions", "apiKey": "ollama", "models": [ { "id": "qwen3-coder" } ] } } } ``` ```json { "defaultProvider": "ollama", "defaultModel": "qwen3-coder" } ``` -------------------------------- ### Start and Verify Ollama Source: https://docs.ollama.com/linux Commands to launch the server and check the installed version. ```shell ollama serve ``` ```shell ollama -v ``` -------------------------------- ### Install OpenCode Source: https://docs.ollama.com/integrations/opencode Installation commands for different operating systems. ```shell curl -fsSL https://opencode.ai/install | bash ``` ```powershell npm install -g opencode-ai ``` -------------------------------- ### Hermes Setup Wizard Prompts Source: https://docs.ollama.com/integrations/hermes Interactive prompts displayed during the manual setup process. ```text How would you like to set up Hermes? → Quick setup — provider, model & messaging (recommended) Full setup — configure everything ``` ```text API base URL [e.g. https://api.example.com/v1]: http://127.0.0.1:11434/v1 ``` ```text API key [optional]: ``` ```text Verified endpoint via http://127.0.0.1:11434/v1/models (1 model(s) visible) Detected model: kimi-k2.5:cloud Use this model? [Y/n]: ``` ```text Context length in tokens [leave blank for auto-detect]: ``` ```text Connect a messaging platform? (Telegram, Discord, etc.) → Set up messaging now (recommended) Skip — set up later with 'hermes setup gateway' ``` ```text Launch hermes chat now? [Y/n]: Y ``` -------------------------------- ### Install Ollama Python SDK Source: https://docs.ollama.com/capabilities/tool-calling Install the required package using pip or uv. ```bash # with pip pip install ollama -U # with uv uv add ollama ``` -------------------------------- ### Quick Setup with Ollama Source: https://docs.ollama.com/integrations/copilot-cli Launch Copilot CLI with Ollama for a quick setup. This command initiates the Copilot CLI and connects it to the default Ollama model. ```shell ollama launch copilot ``` -------------------------------- ### Install Ollama JavaScript library Source: https://docs.ollama.com/capabilities/tool-calling Install the library using npm or bun. ```bash # with npm npm i ollama # with bun bun i ollama ``` -------------------------------- ### Parameter usage examples Source: https://docs.ollama.com/modelfile Commonly used parameters and their syntax for configuration. ```text num_ctx 4096 ``` ```text repeat_last_n 64 ``` ```text repeat_penalty 1.1 ``` ```text temperature 0.7 ``` ```text seed 42 ``` ```text stop "AI assistant:" ``` -------------------------------- ### Install Pi Extensions Source: https://docs.ollama.com/integrations/pi Commands to install additional capabilities via npm or git repositories. ```bash pi install npm:@foo/some-tools pi install git:github.com/user/repo@v1 ``` ```bash pi install npm:@ollama/pi-web-search ``` ```bash pi install https://github.com/davebcn87/pi-autoresearch ``` -------------------------------- ### Build from existing model Source: https://docs.ollama.com/modelfile Example of using an existing model as the base. ```text FROM llama3.2 ``` -------------------------------- ### Install Copilot CLI (npm) Source: https://docs.ollama.com/integrations/copilot-cli Install Copilot CLI globally using npm on all platforms. ```shell npm install -g @github/copilot ``` -------------------------------- ### Launch OpenClaw Source: https://docs.ollama.com/integrations/openclaw Starts the OpenClaw gateway and TUI. Ollama handles installation and initial security configuration automatically. ```bash ollama launch openclaw ``` -------------------------------- ### Install Cline CLI Source: https://docs.ollama.com/integrations/cline-cli Install the Cline CLI globally using npm. ```bash npm install -g cline ``` -------------------------------- ### Install NemoClaw Source: https://docs.ollama.com/integrations/nemoclaw Run the installation script with environment variables configured for Ollama. ```bash curl -fsSL https://www.nvidia.com/nemoclaw.sh | \ NEMOCLAW_NON_INTERACTIVE=1 \ NEMOCLAW_PROVIDER=ollama \ NEMOCLAW_MODEL=nemotron-3-nano:30b \ bash ``` -------------------------------- ### Quick Setup Commands Source: https://docs.ollama.com/integrations/codex Commands for launching, configuring, and restoring the Codex CLI profile with Ollama. ```bash ollama launch codex ``` ```shell ollama launch codex --config ``` ```shell ollama launch codex --restore ``` -------------------------------- ### Install Copilot CLI (Windows WinGet) Source: https://docs.ollama.com/integrations/copilot-cli Install Copilot CLI on Windows using the WinGet package manager. ```powershell winget install GitHub.Copilot ``` -------------------------------- ### Install Codex CLI Source: https://docs.ollama.com/integrations/codex Install the Codex CLI globally using npm. ```bash npm install -g @openai/codex ``` -------------------------------- ### Tool Calling Example Source: https://docs.ollama.com/api/anthropic-compatibility Demonstrates how to use the Ollama API for tool calling with the 'get_weather' tool. Examples are provided in Python, JavaScript, and shell. ```APIDOC ## Tool Calling Example This example demonstrates how to use the Ollama API for tool calling. ### Python Example ```python import anthropic client = anthropic.Anthropic( base_url='http://localhost:11434', api_key='ollama', ) message = client.messages.create( model='qwen3-coder', max_tokens=1024, tools=[ { 'name': 'get_weather', 'description': 'Get the current weather in a location', 'input_schema': { 'type': 'object', 'properties': { 'location': { 'type': 'string', 'description': 'The city and state, e.g. San Francisco, CA' } }, 'required': ['location'] } } ], messages=[{'role': 'user', 'content': "What's the weather in San Francisco?"}] ) for block in message.content: if block.type == 'tool_use': print(f'Tool: {block.name}') print(f'Input: {block.input}') ``` ### JavaScript Example ```javascript import Anthropic from "@anthropic-ai/sdk"; const anthropic = new Anthropic({ baseURL: "http://localhost:11434", apiKey: "ollama", }); const message = await anthropic.messages.create({ model: "qwen3-coder", max_tokens: 1024, tools: [ { name: "get_weather", description: "Get the current weather in a location", input_schema: { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. San Francisco, CA", }, }, required: ["location"], }, }, ], messages: [{ role: "user", content: "What's the weather in San Francisco?" }], }); for (const block of message.content) { if (block.type === "tool_use") { console.log("Tool:", block.name); console.log("Input:", block.input); } } ``` ### Shell Example ```shell curl -X POST http://localhost:11434/v1/messages \ -H "Content-Type: application/json" \ -d '{ "model": "qwen3-coder", "max_tokens": 1024, "tools": [ { "name": "get_weather", "description": "Get the current weather in a location", "input_schema": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state" } }, "required": ["location"] } } ], "messages": [{ "role": "user", "content": "What is the weather in San Francisco?" }] }' ``` ``` -------------------------------- ### Install Droid CLI Source: https://docs.ollama.com/integrations/droid Use this command to install the Droid CLI on your system. ```bash curl -fsSL https://app.factory.ai/cli | sh ``` -------------------------------- ### Install Specific Version Source: https://docs.ollama.com/linux Use the OLLAMA_VERSION environment variable to install a specific release. ```shell curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.5.7 sh ``` -------------------------------- ### Install Copilot CLI (macOS / Linux Homebrew) Source: https://docs.ollama.com/integrations/copilot-cli Install Copilot CLI using Homebrew on macOS or Linux systems. ```shell brew install copilot-cli ``` -------------------------------- ### Generate with images Source: https://docs.ollama.com/api/generate Example of how to include images in the generate request. ```bash curl http://localhost:11434/api/generate -d '{ "model": "llava", "prompt": "what is in this image?", "images": ["iVBORw0KGgoAAAANSUhEUgAAAG0AAABmCAYAAADBPx+VAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA3VSURBVHgB7Z27r0zdG8fX743i1bi1ikMoFMQloXRpKFFIqI7LH4BEQ+NWIkjQuSWCRIEoULk0gsK1kCBI0IhrQVT7tz/7zZo888yz1r7MnDl7z5xvsjkzs2fP3uu71nNfa7lkAsm7d++Sffv2JbNmzUqcc8m0adOSzZs3Z+/XES4ZckAWJEGWPiCxjsQNLWmQsWjRIpMseaxcuTKpG/7HP27I8P79e7dq1ars/yL4/v27S0ejqwv+cUOGEGGpKHR37tzJCEpHV9tnT58+dXXCJDdECBE2Ojrqjh071hpNECjx4cMHVycM1Uhbv359B2F79+51586daxN/+pyRkRFXKyRDAqxEp4yMlDDzXG1NPnnyJKkThoK0VFd1ELZu3TrzXKxKfW7dMBQ6bcuWLW2v0VlHjx41z717927ba22U9APcw7Nnz1oGEPeL3m3p2mTAYYnFmMOMXybPPXv2bNIPpFZr1NHn4HMw0KRBjg9NuRw95s8PEcz/6DZELQd/09C9QGq5RsmSRybqkwHGjh07OsJSsYYm3ijPpy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1UIGKKLv915jsvgtJxCZDubdXr165mzdvtr1Hz5LONA8jrUwKPqsmVesKa49S3Q4WxmRPUEYdTjgiUcfUwLx589ySJUva3oMkP6IYddq6HMS4o55xBJBUeRjzfa4Zdeg56QZ43LhxoyPo7Lf1kNt7oO8wWAbNwaYjIv5lhyS7kRf96dvm5Jah8vfvX3flyhX35cuX6HfzFHOToS1H4BenCaHvO8pr8iDuwoUL7tevX+b5ZdbBair0xkFIlFDlW4ZknEClsp/TzXyAKVOmmHWFVSbDNw1l1+4f90U6IY/q4V27dpnE9bJ+v87QEydjqx/UamVVPRG+mwkNTYN+9tjkwzEx+atCm/X9WvWtDtAb68Wy9LXa1UmvCDDIpPkyOQ5ZwSzJ4jMrvFcr0rSjOUh+GcT4LSg5ugkW1Io0/SCDQBojh0hPlaJdah+tkVYrnTZowP8iq1F1TgMBBauufyB33x1v+NWFYmT5KmppgHC+NkAgbmRkpD3yn9QIseXymoTQFGQmIOKTxiZIWpvAatenVqRVXf2nTrAWMsPnKrMZHz6bJq5jvce6QK8J1cQNgKxlJapMPdZSR64/UivS9NztpkVEdKcrs5alhhWP9NeqlfWopzhZScI6QxseegZRGeg5a8C3Re1Mfl1ScP36ddcUaMuv24iOJtz7sbUjTS4qBvKmstYJoUauiuD3k5qhyr7QdUHMeCgLa1Ear9NquemdXgmum4fvJ6w1lqsuDhNrg1qSpleJK7K3TF0Q2jSd94uSZ60kK1e3qyVpQK6PVWXp2/FC3mp6jBhKKOiY2h3gtUV64TWM6wDETRPLDfSakXmH3w8g9Jlug8ZtTt4kVF0kLUYYmCCtD/DrQ5YhMGbA9L3ucdjh0y8kOHW5gU/VEEmJTcL4Pz/f7mgoAbYkAAAAAElFTkSuQmCC"], "stream": false }' ``` -------------------------------- ### Run and Configure OpenCode Source: https://docs.ollama.com/integrations/opencode Commands to start OpenCode or configure it without an interactive session. ```shell opencode ``` ```shell ollama launch opencode --config ``` -------------------------------- ### Launch Hermes Desktop Source: https://docs.ollama.com/integrations/hermes-desktop Initiates the automated installation and configuration flow for Hermes Desktop. ```bash ollama launch hermes-desktop ``` -------------------------------- ### Install Copilot CLI (macOS / Linux Script) Source: https://docs.ollama.com/integrations/copilot-cli Install Copilot CLI using a curl script on macOS or Linux. ```shell curl -fsSL https://gh.io/copilot-install | bash ``` -------------------------------- ### Launch OpenCode with Ollama Source: https://docs.ollama.com/integrations/opencode Starts the OpenCode agent using Ollama as the backend. ```shell ollama launch opencode ``` -------------------------------- ### Run a model Source: https://docs.ollama.com/quickstart Start a chat session with a specific model or a cloud-based variant. ```shell ollama run gemma4 ``` ```shell ollama run gemma4:cloud ``` -------------------------------- ### Manage running models Source: https://docs.ollama.com/cli Commands to list, stop, and start the Ollama server. ```bash ollama ps ``` ```bash ollama stop gemma4 ``` ```bash ollama serve ``` -------------------------------- ### Manual Pool Configuration Source: https://docs.ollama.com/integrations/pool Environment variable setup and direct execution commands for Pool. ```shell export POOLSIDE_STANDALONE_BASE_URL=http://localhost:11434/v1 export POOLSIDE_API_KEY=ollama ``` ```shell pool -m kimi-k2.6:cloud ``` ```shell POOLSIDE_STANDALONE_BASE_URL=http://localhost:11434/v1 POOLSIDE_API_KEY=ollama pool -m kimi-k2.6:cloud ``` -------------------------------- ### Configure Oh My Pi manually Source: https://docs.ollama.com/integrations/oh-my-pi Opens the configuration interface for OMP after manual installation. ```bash ollama launch omp --config ``` -------------------------------- ### Change Ollama installation directory Source: https://docs.ollama.com/windows Use this command to specify a custom installation path during the setup process. ```powershell OllamaSetup.exe /DIR="d:\some\location" ``` -------------------------------- ### Example conversation using MESSAGE Source: https://docs.ollama.com/modelfile A sequence of MESSAGE commands to guide model responses. ```text MESSAGE user Is Toronto in Canada? MESSAGE assistant yes MESSAGE user Is Sacramento in Canada? MESSAGE assistant no MESSAGE user Is Ontario in Canada? MESSAGE assistant yes ``` -------------------------------- ### Configure Nvidia Container Toolkit (Apt) Source: https://docs.ollama.com/docker Sets up the Nvidia repository and installs the toolkit on Debian-based systems. ```shell curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \ | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg curl -fsSL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \ | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \ | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update ``` ```shell sudo apt-get install -y nvidia-container-toolkit ``` -------------------------------- ### Install and Run Marimo in a Sandbox Source: https://docs.ollama.com/integrations/marimo This command uses uv to execute the marimo editor within a sandboxed environment, ensuring a clean setup for notebook development. ```bash uvx marimo edit --sandbox notebook.py ``` -------------------------------- ### Install Hermes Agent Manually Source: https://docs.ollama.com/integrations/hermes Directly installs the Hermes Agent using the provided installation script. ```bash curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash ``` -------------------------------- ### Launch Oh My Pi with Ollama Source: https://docs.ollama.com/integrations/oh-my-pi Initializes OMP with Ollama as the provider and enables web search tools. ```bash ollama launch omp ``` -------------------------------- ### Define template and system instructions Source: https://docs.ollama.com/modelfile Examples of defining the prompt template, system instructions, and model metadata in a Modelfile. ```text TEMPLATE """{{ if .System }}<|im_start|>system {{ .System }}<|im_end|> {{ end }}{{ if .Prompt }}<|im_start|>user {{ .Prompt }}<|im_end|> {{ end }}<|im_start|>assistant """ ``` ```text SYSTEM """""" ``` ```text ADAPTER ``` ```text ADAPTER ./ollama-lora.gguf ``` ```text LICENSE """ """ ``` -------------------------------- ### Launch integrations Source: https://docs.ollama.com/cli Commands for configuring and launching external integrations. ```bash ollama launch ``` ```bash ollama launch claude ``` ```bash ollama launch claude --model qwen3.5 ``` ```bash ollama launch droid --config ``` -------------------------------- ### Run cloud models Source: https://docs.ollama.com/api/authentication Execute a cloud-hosted model after signing in. ```shell ollama run gpt-oss:120b-cloud ``` -------------------------------- ### Install Claude Code Source: https://docs.ollama.com/integrations/claude-code Use these commands to install Claude Code on your respective operating system. ```shell curl -fsSL https://claude.ai/install.sh | bash ``` ```powershell irm https://claude.ai/install.ps1 | iex ``` -------------------------------- ### Create a model Source: https://docs.ollama.com/openapi.yaml Create a new model from an existing base model with custom system prompts or quantization settings. ```bash curl http://localhost:11434/api/create -d '{ "from": "gemma4", "model": "alpaca", "system": "You are Alpaca, a helpful AI assistant. You only answer with Emojis." }' ``` ```bash curl http://localhost:11434/api/create -d '{ "model": "ollama", "from": "gemma4", "system": "You are Ollama the llama." }' ``` ```bash curl http://localhost:11434/api/create -d '{ "model": "llama3.1:8b-instruct-Q4_K_M", "from": "llama3.1:8b-instruct-fp16", "quantize": "q4_K_M" }' ``` -------------------------------- ### Manual Copilot CLI Setup with Environment Variables Source: https://docs.ollama.com/integrations/copilot-cli Configure Copilot CLI to connect to Ollama using environment variables for the OpenAI-compatible API. Ensure Ollama is running and accessible. ```shell export COPILOT_PROVIDER_BASE_URL=http://localhost:11434/v1 export COPILOT_PROVIDER_API_KEY= export COPILOT_PROVIDER_WIRE_API=responses export COPILOT_MODEL=qwen3.5 ``` -------------------------------- ### Define a custom Modelfile Source: https://docs.ollama.com/modelfile Example configuration for a custom model, including parameter adjustments and a system prompt. ```text FROM llama3.2 # sets the temperature to 1 [higher is more creative, lower is more coherent] PARAMETER temperature 1 # sets the context window size to 4096, this controls how many tokens the LLM can use as context to generate the next token PARAMETER num_ctx 4096 # sets a custom system message to specify the behavior of the chat assistant SYSTEM You are Mario from super mario bros, acting as an assistant. ``` -------------------------------- ### Streaming Messages API Example Source: https://docs.ollama.com/api/anthropic-compatibility An example demonstrating how to stream message content using the Anthropic Messages API with Ollama. ```python import anthropic client = anthropic.Anthropic( base_url='http://localhost:11434', api_key='ollama', ) with client.messages.stream( model='qwen3-coder', max_tokens=1024, messages=[{'role': 'user', 'content': 'Count from 1 to 10'}] ) as stream: for text in stream.text_stream: print(text, end='', flush=True) ``` ```javascript import Anthropic from "@anthropic-ai/sdk"; const anthropic = new Anthropic({ baseURL: "http://localhost:11434", apiKey: "ollama", }); const stream = await anthropic.messages.stream({ model: "qwen3-coder", max_tokens: 1024, messages: [{ role: "user", content: "Count from 1 to 10" }], }); for await (const event of stream) { if ( event.type === "content_block_delta" && event.delta.type === "text_delta" ) { process.stdout.write(event.delta.text); } } ``` ```shell curl -X POST http://localhost:11434/v1/messages \ -H "Content-Type: application/json" \ -d '{ "model": "qwen3-coder", "max_tokens": 1024, "stream": true, "messages": [{ "role": "user", "content": "Count from 1 to 10" }] }' ``` -------------------------------- ### Run Copilot CLI After Manual Setup Source: https://docs.ollama.com/integrations/copilot-cli Execute Copilot CLI after setting the necessary environment variables for Ollama integration. ```shell copilot ``` -------------------------------- ### Configure Nvidia Container Toolkit (Yum/Dnf) Source: https://docs.ollama.com/docker Sets up the Nvidia repository and installs the toolkit on RHEL-based systems. ```shell curl -fsSL https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo \ | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo ``` ```shell sudo yum install -y nvidia-container-toolkit ``` -------------------------------- ### Basic Messages API Example Source: https://docs.ollama.com/api/anthropic-compatibility A simple example demonstrating how to create a message using the Anthropic Messages API with Ollama. ```python import anthropic client = anthropic.Anthropic( base_url='http://localhost:11434', api_key='ollama', # required but ignored ) message = client.messages.create( model='qwen3-coder', max_tokens=1024, messages=[ {'role': 'user', 'content': 'Hello, how are you?'} ] ) print(message.content[0].text) ``` ```javascript import Anthropic from "@anthropic-ai/sdk"; const anthropic = new Anthropic({ baseURL: "http://localhost:11434", apiKey: "ollama", // required but ignored }); const message = await anthropic.messages.create({ model: "qwen3-coder", max_tokens: 1024, messages: [{ role: "user", content: "Hello, how are you?" }], }); console.log(message.content[0].text); ``` ```shell curl -X POST http://localhost:11434/v1/messages \ -H "Content-Type: application/json" \ -H "x-api-key: ollama" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "qwen3-coder", "max_tokens": 1024, "messages": [{ "role": "user", "content": "Hello, how are you?" }] }' ``` -------------------------------- ### Manual Setup Commands Source: https://docs.ollama.com/integrations/codex Commands to manually configure Codex to use Ollama with specific model flags. ```bash codex --oss ``` ```bash codex --oss -m gpt-oss:120b ``` ```bash codex --oss -m gpt-oss:120b-cloud ``` -------------------------------- ### Web Search JavaScript Library Example Output Source: https://docs.ollama.com/capabilities/web-search An example JSON output from the Ollama JavaScript library's web search function, displaying search results. ```json { "results": [ { "title": "Ollama", "url": "https://ollama.com/", "content": "Cloud models are now available..." }, { "title": "What is Ollama? Introduction to the AI model management tool", "url": "https://www.hostinger.com/tutorials/what-is-ollama", "content": "Ollama is an open-source tool..." }, { "title": "Ollama Explained: Transforming AI Accessibility and Language Processing", "url": "https://www.geeksforgeeks.org/artificial-intelligence/ollama-explained-transforming-ai-accessibility-and-language-processing/", "content": "Ollama is a groundbreaking..." } ] } ``` -------------------------------- ### Web Search Python Library Example Output Source: https://docs.ollama.com/capabilities/web-search An example output from the ollama Python library's web search function, showing a list of search results. ```python results = [ { "title": "Ollama", "url": "https://ollama.com/", "content": "Cloud models are now available in Ollama..." }, { "title": "What is Ollama? Features, Pricing, and Use Cases - Walturn", "url": "https://www.walturn.com/insights/what-is-ollama-features-pricing-and-use-cases", "content": "Our services..." }, { "title": "Complete Ollama Guide: Installation, Usage & Code Examples", "url": "https://collabnix.com/complete-ollama-guide-installation-usage-code-examples", "content": "Join our Discord Server..." } ] ``` -------------------------------- ### Launch Hermes Desktop with a specific model Source: https://docs.ollama.com/integrations/hermes-desktop Starts Hermes Desktop directly with a pre-selected model. ```bash ollama launch hermes-desktop --model ``` -------------------------------- ### Web Search API Response Example Source: https://docs.ollama.com/capabilities/web-search This is an example JSON response from the Ollama web search API, containing a list of relevant search results with titles, URLs, and content snippets. ```json { "results": [ { "title": "Ollama", "url": "https://ollama.com/", "content": "Cloud models are now available..." }, { "title": "What is Ollama? Introduction to the AI model management tool", "url": "https://www.hostinger.com/tutorials/what-is-ollama", "content": "Ariffud M. 6min Read..." }, { "title": "Ollama Explained: Transforming AI Accessibility and Language ...", "url": "https://www.geeksforgeeks.org/artificial-intelligence/ollama-explained-transforming-ai-accessibility-and-language-processing/", "content": "Data Science Data Science Projects Data Analysis..." } ] } ``` -------------------------------- ### Pull Qwen3 Model Source: https://docs.ollama.com/capabilities/web-search Download the Qwen3 4B model required for the search agent example. ```bash ollama pull qwen3:4b ``` -------------------------------- ### GET /v1/models Source: https://docs.ollama.com/api/openai-compatibility Lists the available models. ```APIDOC ## GET /v1/models ### Description Lists the available models. ### Method GET ### Endpoint /v1/models ``` -------------------------------- ### Sign in to Ollama Source: https://docs.ollama.com/api/authentication Initiate the authentication process from the local installation. ```shell ollama signin ``` -------------------------------- ### Example API Response with Usage Metrics Source: https://docs.ollama.com/api/usage A sample JSON response from the /api/generate endpoint showing performance metrics like total_duration and token counts. ```json { "model": "gemma4", "created_at": "2025-10-17T23:14:07.414671Z", "response": "Hello! How can I help you today?", "done": true, "done_reason": "stop", "total_duration": 174560334, "load_duration": 101397084, "prompt_eval_count": 11, "prompt_eval_duration": 13074791, "eval_count": 18, "eval_duration": 52479709 } ``` -------------------------------- ### GET /v1/models/{model} Source: https://docs.ollama.com/api/openai-compatibility Retrieves details for a specific model. ```APIDOC ## GET /v1/models/{model} ### Description Retrieves details for a specific model. ### Method GET ### Endpoint /v1/models/{model} ### Parameters #### Path Parameters - **model** (string) - Required - The name of the model ``` -------------------------------- ### Launch Cline with Ollama Source: https://docs.ollama.com/integrations/cline-cli Quickly launch Cline with Ollama as the provider or open the configuration menu. ```shell ollama launch cline ``` ```shell ollama launch cline --config ``` -------------------------------- ### Manually Install Ollama Binaries Source: https://docs.ollama.com/linux Download and extract the specific architecture package to /usr. Ensure old libraries are removed before upgrading. ```shell curl -fsSL https://ollama.com/download/ollama-linux-amd64.tar.zst \ | sudo tar x -C /usr ``` ```shell curl -fsSL https://ollama.com/download/ollama-linux-amd64-rocm.tar.zst \ | sudo tar x -C /usr ``` ```shell curl -fsSL https://ollama.com/download/ollama-linux-arm64.tar.zst \ | sudo tar x -C /usr ```