Skip to main content

Ollama API

Ollama is a tool that enables you to run large language models (LLMs) locally on your machine. The Ollama API connector enables you to connect to Ollama's local REST API to run inference, generate text completions, list available models, and perform chat completions using local LLMs. This connector is particularly useful for applications that need to run LLMs locally for privacy, cost control, or offline capabilities, without relying on cloud-based AI services.

Ollama API icon

Power end-to-end data operations for your Ollama API API with Nexla. Our bi-directional Ollama API connector is purpose-built for Ollama API, making it simple to ingest data, sync it across systems, and deliver it anywhere — all with no coding required. Nexla turns API-sourced data into ready-to-use, reusable data products and makes it easy to send data to Ollama API or any other destination. With comprehensive monitoring, lineage tracking, and access controls, Nexla keeps your Ollama API workflows fast, secure, and fully governed.

Features

Type: API

SourceDestination

  • Seamless API Integration: Connect to any endpoint as source or destination without coding, with automatic data product creation
  • Visual Composition & Chaining: Build complex integrations using visual templates, chain API calls, and compose workflows with data validation and filtering
  • API Proxy: Expose curated slices of your data securely with a secure and customizable API proxy that validates and transforms data on the fly
  • Request optimization with intelligent batching, retry, and caching to minimize API calls and costs

Prerequisites

Before creating an Ollama API credential, you'll need to have Ollama installed and running locally on your machine or accessible via a network URL. Ollama runs locally and does not require authentication by default, but you'll need to know the base URL where your Ollama instance is accessible.

To set up Ollama:

  1. Install Ollama on your local machine or server. You can download Ollama from ollama.ai or install it using package managers.

  2. Start the Ollama service. Ollama typically runs on http://localhost:11434 by default for local installations.

  3. If you're accessing Ollama over a network or through a tunnel (like ngrok), note the base URL where your Ollama instance is accessible. This could be:

    • http://localhost:11434 for local access
    • https://your-domain.com for network access
    • https://your-ngrok-url.ngrok-free.app for tunneled access
  4. Verify that Ollama is running by accessing the version endpoint: {base_url}/api/version. This should return the Ollama version information.

Ollama runs locally and does not require authentication by default. However, if you've configured authentication for your Ollama instance, you may need to provide credentials. For most local installations, no authentication is required, and you only need to specify the base URL where Ollama is accessible.

For detailed information about Ollama installation and configuration, refer to the Ollama Documentation.

Authenticate

Credentials required

Ollama runs locally and does not require authentication.

FieldRequiredSecretDescription
Base URLYesNoThe base URL for your locally running Ollama instance.

Create a credential in Nexla

  1. After selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.

New Credential Overlay – Ollama

OllamaCred.png
  1. Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.

  2. Enter the base URL for your locally running Ollama instance in the Base URL field. This should be the complete URL including the protocol (http:// or https://) and port if applicable. Common examples include:

    • http://localhost:11434 for local installations
    • https://your-domain.com for network access
    • https://your-ngrok-url.ngrok-free.app for tunneled access

    The default value is typically http://localhost:11434 for local Ollama installations. If you're using a tunnel or network-accessible Ollama instance, update this to match your Ollama instance URL. Ensure that the URL is accessible from where Nexla will be making API calls.

  3. Click the Save button at the bottom of the overlay. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation.

Use as a data source

To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Select the Ollama API connector tile, then select the credential that will be used to connect to the Ollama instance, and click Next; or, create a new Ollama API credential for use in this flow.

Endpoint templates

Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common Ollama API endpoints. Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below.

Get Version

This endpoint retrieves the Ollama version information. Use this endpoint when you need to check the Ollama version, verify connectivity, or get system information about your Ollama instance.

  • This endpoint automatically retrieves the version information from your Ollama instance. No additional configuration is required beyond selecting this endpoint template.

The Get Version endpoint uses GET requests to retrieve version information from the Ollama API. This is a simple endpoint useful for testing connectivity and verifying that your Ollama instance is running correctly. For more information about the Get Version endpoint, refer to the Ollama API Documentation.

List Models

This endpoint retrieves all locally available models in Ollama. Use this endpoint when you need to list available models, check which models are installed, or get model information for further API calls.

  • This endpoint automatically retrieves all models available in your Ollama instance. No additional configuration is required beyond selecting this endpoint template.

The List Models endpoint uses GET requests to retrieve model information from the Ollama API. The endpoint returns a list of all models that have been downloaded and are available for use in your Ollama instance. For more information about the List Models endpoint, refer to the Ollama API Documentation.

Generate Text

This endpoint generates text using a model and prompt. Use this endpoint when you need to generate text completions, perform text generation tasks, or get responses from local LLMs.

  • Enter the name of the local model to use in the Model Name field. Examples include llama3, mistral, codellama, or other models you have installed in Ollama. You can use the "List Models" endpoint to see available models.
  • Enter the prompt text in the Prompt field. This is the input text that the model will use to generate completions.

The Generate Text endpoint uses POST requests to send prompts to the Ollama API and returns generated text completions. The endpoint supports various local models and provides text generation capabilities without requiring cloud-based AI services. For more information about the Generate Text endpoint, refer to the Ollama API Documentation.

Chat Completion

This endpoint runs a multi-turn chat completion using a local model. Use this endpoint when you need to build conversational AI applications, create chatbots, or perform interactive text generation with context.

  • Enter the model name to use in the Model Name field. Examples include llama3, mistral, codellama, or other models you have installed in Ollama.
  • Enter the messages array in JSON format in the Messages (JSON Array) field. The messages should be an array of objects with role and content fields. For example: [{"role": "user", "content": "Hello!"}, {"role": "assistant", "content": "Hi there!"}, {"role": "user", "content": "How are you?"}].

The Chat Completion endpoint uses POST requests to send chat messages to the Ollama API and returns conversational responses. The endpoint supports multi-turn conversations with context, allowing you to build interactive chat applications using local LLMs. For more information about the Chat Completion endpoint, refer to the Ollama API Documentation.

Once the selected endpoint template has been configured, click the Test button to the right of the endpoint selection menu to retrieve a sample of the data that will be fetched. Sample data will be displayed in the Endpoint Test Result panel on the right, allowing you to verify that the source is configured correctly before saving.

Manual configuration

Ollama API data sources can also be manually configured to ingest data from any valid Ollama API endpoint, including endpoints not covered by the pre-built templates or custom API configurations. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, endpoint URL, date/time and lookup macros, path to data, metadata, and request headers.

Ollama API endpoints typically follow the pattern {base_url}/api/{operation}, where {base_url} is your Ollama base URL configured in the credential. Common endpoints include /api/version and /api/tags (GET, for listing models), and /api/generate and /api/chat (POST, for generation and chat completions).

For Path to Data, common paths include $ for the entire response, $.models[*] for arrays of models, or $.response for generated text. Content-Type is typically set to application/json for POST requests. Request bodies typically include a model field (e.g., "llama3"), a prompt field for text generation or a messages array for chat completions, and optionally a stream field set to false for non-streaming responses.

Once all of the relevant settings have been configured, click the Create button in the upper right corner of the screen to save and create the new Ollama API data source. Nexla will now begin ingesting data from the configured endpoint and will organize any data that it finds into one or more Nexsets.