Skip to content

[Bug] Invalid response at the Copilot provider #3182

@rafael-vasconcellos

Description

@rafael-vasconcellos

Before submitting
☑️ I checked Known Issues
☑️ I searched existing issues

Configuration

  • Model: gpt-5
  • Provider: Copilot
  • Interface: API

Environment

  • Python version: 3.12.2
  • OS: Windows 11

Bug description
Clear steps to reproduce:

  1. Exact command/file used:
    g4f api
  2. Environment location: BR
ERROR:g4f.api: Invalid response: {'event': 'challenge', 'method': None, 'parameter': None, 'id': '1'}
Traceback (most recent call last):
  File "C:\Python312\Lib\site-packages\g4f\api\__init__.py", line 461, in chat_completions
    return await response
           ^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\g4f\client\__init__.py", line 319, in async_iter_append_model_and_provider
    async for chunk in response:
  File "C:\Python312\Lib\site-packages\g4f\client\__init__.py", line 185, in async_iter_response
    async for chunk in response:
  File "C:\Python312\Lib\site-packages\g4f\tools\run_tools.py", line 257, in async_iter_run_tools
    async for chunk in response:
  File "C:\Python312\Lib\site-packages\g4f\providers\asyncio.py", line 73, in to_async_iterator
    async for item in iterator:
  File "C:\Python312\Lib\site-packages\g4f\providers\base_provider.py", line 503, in create_async_generator
    async for chunk in response:
  File "C:\Python312\Lib\site-packages\g4f\providers\asyncio.py", line 73, in to_async_iterator
    async for item in iterator:
  File "C:\Python312\Lib\site-packages\g4f\Provider\Copilot.py", line 80, in create_authed
    async for chunk in cls.create(model, messages, **kwargs):
  File "C:\Python312\Lib\site-packages\g4f\Provider\Copilot.py", line 233, in create
    raise RuntimeError(f"Invalid response: {last_msg}")
RuntimeError: Invalid response: {'event': 'challenge', 'method': None, 'parameter': None, 'id': '1'}

is this "challenge" related to some captcha validation? the Copilot provider require auth now? if so, it should be moved to needs_auth.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixedthis issue was recently fixedstale

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions