The proxy forwards /v1/chat/completions requests to Meta AI’s GraphQL endpoint and converts the response to an OpenAI‑style format.
It supports both streaming and non‑streaming modes.
-
Clone this repository.
-
Install Bun if you haven’t already.
-
Create a
.envfile in the project root:COOKIES="<your meta.ai cookies>" PORT=8080 # optional, defaults to 8080
How to get the cookies
Open your browser’s developer tools, go to the Application tab (Chrome) or Storage (Firefox), and copy the full cookie string formeta.ai.
Paste it exactly as‑is (e.g.datr=…; sb=…; …). -
Run the server:
bun run .
The endpoint will be available at http://localhost:8080/v1/chat/completions.
The repository includes an opencode.json file that configures the OpenCode CLI to use this proxy as its AI backend.
Point your OpenCode configuration to it, or reference it as needed.
Send requests exactly like you would to the OpenAI API:
POST /v1/chat/completions
{
"model": "musespark",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"stream": true
}- The proxy automatically rewrites
"You are opencode"to"You are Meta AI"to avoid identity conflicts. - System messages are sent as a standalone first message to prevent length‑related issues with Meta AI.
- Conversation continuity is maintained across requests that share the same first user message (hashed internally) – no extra
"user"field required.
| Variable | Default | Description |
|---|---|---|
COOKIES |
(required) | Full cookie string from meta.ai |
PORT |
8080 |
Server port |
All logs are written to ./logs/openai.log and ./logs/openai_raw.log.