Last active
April 21, 2026 07:30
-
-
Save minyk/685cfa1597eb51cb03f10456f4c4c4d4 to your computer and use it in GitHub Desktop.
Possible diff for nanobot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: nanobot/providers/openai_compat_provider.py | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| diff --git a/nanobot/providers/openai_compat_provider.py b/nanobot/providers/openai_compat_provider.py | |
| --- a/nanobot/providers/openai_compat_provider.py (revision 6c24f24e9eadf1602858e96878c82887cd97fad3) | |
| +++ b/nanobot/providers/openai_compat_provider.py (date 1776756568312) | |
| @@ -155,7 +155,8 @@ | |
| if not api_base: | |
| return True | |
| normalized = api_base.strip().lower().rstrip("/") | |
| - return "api.openai.com" in normalized and "openrouter" not in normalized | |
| + allowed = ("api.openai.com", "api.githubcopilot.com") | |
| + return any(domain in normalized for domain in allowed) and "openrouter" not in normalized | |
| def _responses_circuit_key( | |
| @@ -430,7 +431,7 @@ | |
| reasoning_effort: str | None, | |
| ) -> bool: | |
| """Use Responses API only for direct OpenAI requests that benefit from it.""" | |
| - if self._spec and self._spec.name != "openai": | |
| + if self._spec and self._spec.name not in ["openai", "github_copilot"]: | |
| return False | |
| if not _is_direct_openai_base(self._effective_base): | |
| return False | |
| @@ -439,7 +440,7 @@ | |
| wants = False | |
| if reasoning_effort and reasoning_effort.lower() != "none": | |
| wants = True | |
| - elif any(token in model_name for token in ("gpt-5", "o1", "o3", "o4")): | |
| + elif any(token in model_name for token in ("gpt-5.", "o1", "o3", "o4")): | |
| wants = True | |
| if not wants: | |
| return False | |
| @@ -511,6 +512,7 @@ | |
| ) -> dict[str, Any]: | |
| """Build a Responses API body for direct OpenAI requests.""" | |
| model_name = model or self.default_model | |
| + model_name = model_name.split("/")[-1] | |
| sanitized_messages = self._sanitize_messages(self._sanitize_empty_content(messages)) | |
| instructions, input_items = convert_messages(sanitized_messages) | |
| Index: nanobot/providers/registry.py | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| diff --git a/nanobot/providers/registry.py b/nanobot/providers/registry.py | |
| --- a/nanobot/providers/registry.py (revision 6c24f24e9eadf1602858e96878c82887cd97fad3) | |
| +++ b/nanobot/providers/registry.py (date 1776756203045) | |
| @@ -222,6 +222,7 @@ | |
| backend="github_copilot", | |
| default_api_base="https://api.githubcopilot.com", | |
| strip_model_prefix=True, | |
| + supports_max_completion_tokens=True, | |
| is_oauth=True, | |
| ), | |
| # DeepSeek: OpenAI-compatible at api.deepseek.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment