---
title: "Test connection to Ollama instance"
method: POST
path: "/v1/private/ollama/test-connection"
tags: ["Ollama"]
---

# Test connection to Ollama instance

`POST /v1/private/ollama/test-connection`

Validates that the provided Ollama URL is reachable. URL may be provided with or without /v1 suffix (e.g., http://localhost:11434 or http://localhost:11434/v1). The /v1 suffix will be automatically removed for connection testing. For inference, use the URL with /v1 suffix.

## Request body

- OllamaInstanceBaseUrlRequest — Request with Ollama instance base URL for connection testing or model discovery.
  - `base_url` string, required — Base URL of the Ollama instance. May include /v1 suffix which will be automatically removed for connection testing. For inference, use the URL with /v1 suffix for OpenAI-compatible endpoints.
  - `api_key` string — Optional API key for authenticated Ollama instances. If provided, will be sent as Bearer token in Authorization header.

## Response `200`

Connection test successful

- OllamaConnectionTestResponse — Response from Ollama connection test.
  - `connected` boolean — Whether the connection was successful
  - `version` string — Server version (returned even if connection failed or version is incompatible)
  - `error_message` string — Error message if connection failed

## Other responses

- `422` — Unprocessable Content - Invalid URL format
- `502` — Connection test failed - Ollama instance unreachable
- `503` — Ollama provider is disabled

---

[API](https://skmtc.net/comet-ml/apis/opik-rest-api.md) · [All operations](https://skmtc.net/comet-ml/apis/opik-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/comet-ml/opik-rest-api/versions/4ed2fbc97cc3/schema)
