Skip to content

v5.1#118

Merged
Nayjest merged 6 commits intomainfrom
v5_1
Feb 2, 2026
Merged

v5.1#118
Nayjest merged 6 commits intomainfrom
v5_1

Conversation

@Nayjest
Copy link
Owner

@Nayjest Nayjest commented Feb 1, 2026

Features:

  • HTTP headers: universal global configuration and per-request argument for OpenAI + Anthropic + Google API

@github-actions

This comment has been minimized.

@Nayjest
Copy link
Owner Author

Nayjest commented Feb 1, 2026

@todo
Bundle with Nayjest/lm-proxy#23

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

I've Reviewed the Code

The PR adds HTTP header customization support for LLM API requests across OpenAI, Anthropic, and Google backends with both global and per-request configuration options, but the inject_headers function in the Google GenAI client silently ignores unsupported http_options types instead of raising an error.

⚠️ 1 issue found across 11 files

#1 Silently ignores unhandled http_options types

microcore/llm/google_genai.py L66-L80

The inject_headers function only handles dict and HttpOptions types for http_options. If http_options is any other type, the function silently does nothing, which could lead to headers not being injected without any warning or error. This is a potential bug where the caller expects headers to be injected but they are not.
Tags: bug
Affected code:

66: def inject_headers(headers: Mapping[str,str], params: dict) -> None:
67:     """
68:     Inject extra HTTP headers into the params dictionary for Google GenAI client.
69:     """
70:     if "http_options" not in params:
71:         params["http_options"] = {}
72:     http_options = params["http_options"]
73:     if isinstance(http_options, dict):
74:         if "headers" not in http_options:
75:             http_options["headers"] = {}
76:         http_options["headers"].update(headers)
77:     elif isinstance(http_options, HttpOptions):
78:         if http_options.headers is None:
79:             http_options.headers = {}
80:         http_options.headers.update(headers)

Proposed change:

def inject_headers(headers: Mapping[str, str], params: dict) -> None:
    """
    Inject extra HTTP headers into the params dictionary for Google GenAI client.
    """
    if "http_options" not in params:
        params["http_options"] = {}
    http_options = params["http_options"]
    if isinstance(http_options, dict):
        if "headers" not in http_options:
            http_options["headers"] = {}
        http_options["headers"].update(headers)
    elif isinstance(http_options, HttpOptions):
        if http_options.headers is None:
            http_options.headers = {}
        http_options.headers.update(headers)
    else:
        raise TypeError(f"Unsupported http_options type: {type(http_options)}")

@Nayjest Nayjest merged commit 8f92300 into main Feb 2, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments