From 5a38afe5e09811b5b8703a36d8ea1fa4e579ac88 Mon Sep 17 00:00:00 2001 From: yurekami Date: Mon, 29 Dec 2025 05:40:23 +0900 Subject: [PATCH] fix: suppress verbose httpx request logging at INFO level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, httpx logs HTTP request/response information at INFO level, which clutters application logs with messages like: "HTTP Request: POST http://... 'HTTP/1.1 200 OK'" This change sets the httpx logger to WARNING level by default, suppressing these verbose logs. Users who want to see HTTP request logs can still enable them by setting the httpx logger level back to INFO or DEBUG in their application: import logging logging.getLogger('httpx').setLevel(logging.INFO) Fixes #539 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- ollama/_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ollama/_client.py b/ollama/_client.py index ae755eb..f011bad 100644 --- a/ollama/_client.py +++ b/ollama/_client.py @@ -1,6 +1,7 @@ import contextlib import ipaddress import json +import logging import os import platform import sys @@ -26,6 +27,11 @@ import anyio from pydantic.json_schema import JsonSchemaValue +# Set httpx logger to WARNING level to suppress verbose HTTP request logs at INFO level. +# Users who want to see these logs can set the level back to INFO or DEBUG in their application. +# See: https://github.com/ollama/ollama-python/issues/539 +logging.getLogger('httpx').setLevel(logging.WARNING) + from ollama._utils import convert_function_to_tool if sys.version_info < (3, 9):