API / dg-ai

DG AI API

A totally free AI API for all — no login, no API key, no account. Powered by Cloudflare Workers, with a smart fallback system and 5 different models.

LIM Limits

60,000
requests / day
20 / min
rate limit
5
models available

MDL Available models

DG AI offers five different models behind one API, with a smart fallback system between them:

ChatGPT — gpt-oss-120b DeepSeek — r1-distill-32b Qwen 12B — qwen-2.5-7b Gemma — 3-12b-it Qwen Coder — 2.5-32b

REQ Default request

Hitting the base URL routes your request through the fallback system across all 5 models:

// Example: How to connect your app to the Free AI API
async function askAI(userPrompt) {
  const API_URL = "https://dg-ai.scriptsnsenses.workers.dev/";

  try {
    const response = await fetch(API_URL, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        messages: [
          {
            role: "system",
            content: "You are a helpful assistant."
          },
          {
            role: "user",
            content: userPrompt
          }
        ]
      })
    });

    const data = await response.json();

    // Extract the text response from the model
    const reply = data.response.choices[0].message.content;
    console.log("AI Reply:", reply);
    return reply;

  } catch (error) {
    console.error("Error calling the AI API:", error);
  }
}

// Usage:
askAI("Give me a 3-word motto for a programmer.");

MDL Calling a specific model

Each model also has its own dedicated path under /v1/chat/ if you want to skip the fallback system and target one directly.

ChatGPT (gpt-oss-120b)

// Example: How to connect your app specifically to the ChatGPT model
async function askChatGPT(userPrompt) {
  // Your specific ChatGPT model endpoint path
  const API_URL = "https://dg-ai.scriptsnsenses.workers.dev/v1/chat/gpt-oss-120b";

  try {
    const response = await fetch(API_URL, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        messages: [
          {
            role: "system",
            content: "You are a helpful assistant."
          },
          {
            role: "user",
            content: userPrompt
          }
        ]
      })
    });

    const data = await response.json();
    const reply = data.response.choices[0].message.content;
    console.log("ChatGPT Reply:", reply);
    return reply;

  } catch (error) {
    console.error("Error calling ChatGPT:", error);
  }
}

// Usage:
askChatGPT("Write a funny 1-line error message for a broken server connection.");

DeepSeek (r1-distill-32b)

// Example: How to connect your app specifically to the DeepSeek model
async function askDeepSeek(userPrompt) {
  // Your specific DeepSeek model endpoint path
  const API_URL = "https://dg-ai.scriptsnsenses.workers.dev/v1/chat/r1-distill-32b";

  try {
    const response = await fetch(API_URL, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        messages: [
          {
            role: "system",
            content: "You are a helpful assistant."
          },
          {
            role: "user",
            content: userPrompt
          }
        ]
      })
    });

    const data = await response.json();
    const reply = data.response.choices[0].message.content;
    console.log("DeepSeek Reply:", reply);
    return reply;

  } catch (error) {
    console.error("Error calling DeepSeek:", error);
  }
}

// Usage:
askDeepSeek("Explain the concept of serverless computing in one simple sentence.");

Qwen 12B (qwen-2.5-7b)

// Example: How to connect your app specifically to the Qwen 12B model
async function askQwen(userPrompt) {
  // Your specific Qwen 12B model endpoint path
  const API_URL = "https://dg-ai.scriptsnsenses.workers.dev/v1/chat/qwen-2.5-7b";

  try {
    const response = await fetch(API_URL, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        messages: [
          {
            role: "system",
            content: "You are a helpful assistant."
          },
          {
            role: "user",
            content: userPrompt
          }
        ]
      })
    });

    const data = await response.json();
    const reply = data.response.choices[0].message.content;
    console.log("Qwen Reply:", reply);
    return reply;

  } catch (error) {
    console.error("Error calling Qwen 12B:", error);
  }
}

// Usage:
askQwen("Give me a quick recipe idea using just eggs, tomatoes, and bread.");

Qwen Coder (2.5-32b)

// Example: How to connect your app specifically to the Qwen Coder model
async function askQwenCoder(userPrompt) {
  // Your specific Qwen Coder model endpoint path
  const API_URL = "https://dg-ai.scriptsnsenses.workers.dev/v1/chat/2.5-32b";

  try {
    const response = await fetch(API_URL, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        messages: [
          {
            role: "system",
            content: "You are an expert software engineer assistant."
          },
          {
            role: "user",
            content: userPrompt
          }
        ]
      })
    });

    const data = await response.json();
    const reply = data.response.choices[0].message.content;
    console.log("Qwen Coder Reply:", reply);
    return reply;

  } catch (error) {
    console.error("Error calling Qwen Coder:", error);
  }
}

// Usage:
askQwenCoder("Write a quick JavaScript function to reverse a string.");

RTE Model routes at a glance

ModelPath
ChatGPT (gpt-oss-120b)/v1/chat/gpt-oss-120b
DeepSeek (r1-distill-32b)/v1/chat/r1-distill-32b
Qwen 12B (qwen-2.5-7b)/v1/chat/qwen-2.5-7b
Qwen Coder (2.5-32b)/v1/chat/2.5-32b

Gemma (3-12b-it) is available through the default fallback endpoint.

+++ Discord perks

Joining the Discord unlocks extended access on top of the free tier:

Support the project: most DG Develops projects are free-for-all — no money required, just time. Join in and help build what's next: discord.gg/4ApADpxGQV