Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Test connection to Ollama instance

POST/v1/private/ollama/test-connectionTest connection to Ollama instance

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

required
application/json
objectOllamaInstanceBaseUrlRequest

Request with Ollama instance base URL for connection testing or model discovery.

api_keystring

Optional API key for authenticated Ollama instances. If provided, will be sent as Bearer token in Authorization header.

base_urlstringrequired

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.

minLength 1

Example request
{
  "api_key": "",
  "base_url": "http://localhost:11434/v1"
}

Responses

200Connection test successfulapplication/json
objectOllamaConnectionTestResponse

Response from Ollama connection test.

connectedboolean

Whether the connection was successful

error_messagestring

Error message if connection failed

versionstring

Server version (returned even if connection failed or version is incompatible)

Example response
{
  "connected": true,
  "error_message": "string",
  "version": "string"
}
422Unprocessable Content - Invalid URL formatapplication/json
objectErrorMessage
codeinteger · int32
detailsstring
messagestring
Example response
{
  "code": 0,
  "details": "string",
  "message": "string"
}
502Connection test failed - Ollama instance unreachableapplication/json
objectOllamaConnectionTestResponse

Response from Ollama connection test.

connectedboolean

Whether the connection was successful

error_messagestring

Error message if connection failed

versionstring

Server version (returned even if connection failed or version is incompatible)

Example response
{
  "connected": true,
  "error_message": "string",
  "version": "string"
}
503Ollama provider is disabledapplication/json
objectErrorMessage
codeinteger · int32
detailsstring
messagestring
Example response
{
  "code": 0,
  "details": "string",
  "message": "string"
}
Documentation menu