Point the OpenAI Node SDK at Refuseless

    All guides

    You switch the OpenAI Node SDK to Refuseless by setting baseURL to https://api.refuseless.com/v1 and apiKey to a Refuseless key. The option name is camelCase. Python's is base_url. Mixing them up is the usual first bug: the SDK ignores the misspelled field and calls OpenAI, or it calls us without a key. Chat completions keep the same object shape.

    How do you point the Node SDK at Refuseless?

    Install openai from npm if you do not have it. Put the key in REFUSELESS_API_KEY. Use a model id from the lineup. The sample uses glm-5.3-abliterated. Swap in glm-5.3-flash-abliterated for the Flash model.

    Switching the OpenAI SDK to RefuselessYour app keeps using the OpenAI SDK. The SDK sends chat completions to api.refuseless.com/v1, which runs glm-5.3-abliterated. Only the base URL, the API key, and the model id change.Your appOpenAI SDK, unchangedapi.refuseless.com/v1POST /chat/completionsglm-5.3-abliteratedrefusal-edited weightsThree values change. Nothing else does.base URLapi.openai.com/v1→api.refuseless.com/v1API keyOPENAI_API_KEY→REFUSELESS_API_KEYmodelyour OpenAI model id→glm-5.3-abliterated
    Only three values change. The Node SDK calls the base URL baseURL.
    Node
    import OpenAI from "openai";
    
    const client = new OpenAI({
      apiKey: process.env.REFUSELESS_API_KEY,
      baseURL: "https://api.refuseless.com/v1",
    });
    
    const response = await client.chat.completions.create({
      model: "glm-5.3-abliterated",
      messages: [
        { role: "user", content: "Summarize this function in one paragraph." },
      ],
    });
    
    console.log(response.choices[0].message.content);

    Does the base URL include /v1?

    Pass https://api.refuseless.com/v1, not the bare origin and not a full path to /chat/completions. The SDK adds the method path. A doubled /v1/v1 is a 404, and the body will tell you the path was unknown. ESM is what the sample uses. In CommonJS, const OpenAI = require("openai") and the same constructor fields.

    Which errors will you see?

    • 401 "Missing bearer API key" means the header was empty. The env var is unset in this process, or the option was named api_key and ignored.
    • 401 "Invalid API key" means we received a key that is not a Refuseless key.
    • 404 model_not_found means the id string is wrong. List ids with GET /v1/models before you edit the prompt.

    Agents that already speak the OpenAI shape, and want a config block instead of an SDK call, are covered in the docs and in the console examples. This page is only the Node SDK. Retention is zero prompt retention, which does not change the client code.

    Get an API keySee the lineup