[Experimenting with pure browser automation instead of scripts] M365-Copilot2API: turn Microsoft 365 Copilot into an OpenAI/Anthropic-compatible API

This is a continuation and completion of https://4gfj4hgkj4as4.pages.dev/t/topic/96870. :xhj19:

Features:

Full Copilot conversational capabilities — Streaming/non-streaming, multi-turn dialogue, deep reasoning

OpenAI-compatible API — Directly plug into existing OpenAI ecosystem tools by simply replacing the base_url

Anthropic Messages compatible — Supports the /v1/messages endpoint as well

Model switching — Auto / Quick / Reasoning / GPT-5.2-5.5 / Claude_Sonnet†

Encrypted credential storage — Refresh token is saved to disk using AES-128-CBC encryption

Zero browser dependency — Token refresh bypasses SPA restrictions via Origin Spoofing

Claude_Sonnet tag is accepted by the server, but on the backend it actually routes to GPT-5.

In theory, supports unlimited GPT-5 calls. And it’s directly accessible from within China, with no blocks. :xhj15:

Project page: GitHub - HEXUXIU/M365-Copilot2API: Access M365 Copilot via CLI & OpenAI-compatible API · GitHub

:star: If this project is helpful to you, feel free to give it a Star :star::ac01:

btw, I’ve noticed many folks are failing to acquire tokens. You can check out this project for reference: GitHub - lezi-fun/m365-copilot-client · GitHub (the README for this project looks much better than mine)

44 Likes

I’m here to check out the pros.

1 Like

What do you think of my desktop version? It also supports calling tools.

2 Likes

Sure, awa

They’re all guys, oh man.

Boss, you’re awesome—I starred it!

看起来不错呀

Set this topic as recommended and rewarded 200 energy points

Interesting, I starred it too.

Thanks a lot, boss!

Already starred, looking forward to you releasing a Docker version, boss!

5 Likes

Awesome! Are you considering making a Docker deployment, boss?

Come over and show some support.

1 Like

Can it still be converted?

1 Like

How do I do this?

tool call available?

Wonderful, thanks mate

Awesome, boss!

So awesome

Worshipping the pro