JavaScript quickstart

Call DeepSeek from JavaScript with gogogoapi

Use fetch from a backend route, worker, or serverless function to call the live DeepSeek endpoint with a gogogoapi API key.

Node.js fetch example

Call the gogogoapi DeepSeek route from server-side JavaScript and keep the bearer key in your deployment environment.

const response = await fetch("https://www.gogogoapi.com/api/v1/chat/deepseek", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GOGOGOAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "deepseek-v4-flash",
    messages: [{ role: "user", content: "Write a concise product update." }],
    maxCompletionTokens: 256,
  }),
});

const data = await response.json();

Works with server routes

Use the route from Next.js, Express, workers, or other backend JavaScript runtimes.

No frontend key exposure

Keep the API key in the server environment and proxy only your own app's safe response to the browser.

Ledger visibility

Each completed request settles into the gogogoapi balance history so test spend is visible.

Decision guide

JavaScript setup checklist

Use this snapshot to decide whether the route matches your first production or smoke-test use case.

Runtime
Node.js or serverless

Use backend code, not public browser code.

Endpoint
/api/v1/chat/deepseek

Call the live DeepSeek route directly for the first test.

Budget
maxCompletionTokens

Keep output small for smoke tests and increase later.

FAQ

Questions before you test

Short answers for the questions developers usually ask before creating the first API key.

Can I call gogogoapi from a React component?

Do not call gogogoapi directly from public client components because that would expose your bearer key.

Can I use TypeScript?

Yes. The HTTP shape is JSON, so TypeScript works well around typed request and response wrappers.

What is the fastest first test?

Send one short prompt from a backend route and confirm the dashboard ledger updates after the response.

Ready to build

Sign in, buy credits, create an API key.

Use the dashboard to fund USD credits with USDT or USDC, create a backend key, and send your first China model API request.

Open dashboard