Skip to content

Alleexxi/metaai-opencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Tool calling is currently broken – I haven’t been able to fix it yet.

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.


Setup

  1. Clone this repository.

  2. Install Bun if you haven’t already.

  3. Create a .env file 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 for meta.ai.
    Paste it exactly as‑is (e.g. datr=…; sb=…; …).

  4. Run the server:

    bun run .

The endpoint will be available at http://localhost:8080/v1/chat/completions.


opencode.json

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.


Usage

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.

Configuration

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors