Python quickstart

Call DeepSeek from Python with a prepaid API key

Use a server-side Python environment to send DeepSeek chat requests through gogogoapi while keeping API keys, balance, and usage history in one dashboard.

Python fetch pattern

Keep the key in an environment variable, call the DeepSeek chat route from your backend, and start with a small output budget.

import os
import requests

response = requests.post(
    "https://www.gogogoapi.com/api/v1/chat/deepseek",
    headers={
        "Authorization": f"Bearer {os.environ['GOGOGOAPI_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "deepseek-v4-flash",
        "messages": [
            {"role": "user", "content": "Summarize this customer note."}
        ],
        "maxCompletionTokens": 256,
    },
)

print(response.json())

Backend-friendly

Python jobs, server routes, workers, and notebooks can keep the gogogoapi key out of browser code.

Prepaid spend boundary

Requests draw from the available USD API credit balance after quote and settlement checks.

Simple migration test

Use a short prompt first, then move longer chains or batch jobs after the first ledger entry looks right.

Decision guide

Python setup checklist

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

Package
requests or an OpenAI-compatible client

Start with plain HTTP if you want to see the exact route.

Secret
GOGOGOAPI_KEY

Store it server-side and rotate from the dashboard when needed.

Model
deepseek-v4-flash

Use the low-cost live route for the first smoke test.

FAQ

Questions before you test

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

Can I use the Python OpenAI client?

Use it if your client version supports a custom base URL and bearer key. Plain HTTP is also a clear first test.

Can I run this in a notebook?

Yes, but keep the key in a secret or environment variable and avoid sharing notebook outputs that expose credentials.

What should I check after the request?

Confirm the response, then review the dashboard ledger to verify the request settled against your prepaid balance.

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