DEV Community

CloudGPU
CloudGPU

Posted on Originally published at cloudgpu.app

DeepSeek V4.1 Flash in the OpenAI SDK and Aider: change one base URL

Short answer: if your code already uses the OpenAI SDK, you can call DeepSeek V4.1 Flash by changing two values: set the base URL to https://cloudgpu.app/v1 and set the model to deepseek-v4.1-flash. Aider works the same way through its OpenAI-compatible settings.

Disclosure: I work on CloudGPU, and the endpoint below is ours.

Three DeepSeek IDs, and which is which

The CloudGPU API page lists three DeepSeek chat models (checked 2026-10-26):

Model ID What it is
deepseek-v4.1-flash DeepSeek V4.1 Flash
deepseek-v4-flash DeepSeek V4 Flash, served from the April checkpoint, not V4.1
deepseek-v4-pro DeepSeek V4 Pro, for harder reasoning and long multi-step tool use

IDs are case-sensitive and the dot matters: a wrong ID comes back as 400 model_not_found. Per-token rates change, so this post doesn't repeat them; the current rate for each model is on the CloudGPU API page.

Get a key

  1. Sign up with an email address or a Google account.
  2. Add balance by card, Alipay, Google Pay, Apple Pay or USDT. The same balance pays for GPU rentals too.
  3. Create a key in the API console. It starts with cgw-sk- and is shown only once, so put it straight into your environment:
export CGW_API_KEY="cgw-sk-..."
Enter fullscreen mode Exit fullscreen mode

Smoke test with curl

curl https://cloudgpu.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $CGW_API_KEY" \
  -d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"hello"}]}'
Enter fullscreen mode Exit fullscreen mode

To list the model IDs your key can use:

curl https://cloudgpu.app/v1/models \
  -H "Authorization: Bearer $CGW_API_KEY"
Enter fullscreen mode Exit fullscreen mode

Without the Authorization header this returns 401 with missing_authorization, so check the key first if you see that.

OpenAI Python SDK

# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["CGW_API_KEY"],
    base_url="https://cloudgpu.app/v1",
)

resp = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Explain the KV cache in one sentence."}],
    stream=True,
)
for chunk in resp:
    print(chunk.choices[0].delta.content or "", end="")
Enter fullscreen mode Exit fullscreen mode

To compare the three DeepSeek models on the same prompt, loop over the IDs and keep everything else the same:

for model in ["deepseek-v4.1-flash", "deepseek-v4-flash", "deepseek-v4-pro"]:
    r = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": "Write a Python debounce function."}],
    )
    print(f"--- {model}\n{r.choices[0].message.content}\n")
Enter fullscreen mode Exit fullscreen mode

If you later switch the same loop to a thinking model such as glm-5.3-flash, don't set max_tokens too low: reasoning tokens count toward it, and with a small limit the visible content can come back empty with finish_reason="length". Raise the limit or pass reasoning_effort="low".

Node.js

// npm install openai; name the file index.mjs (top-level await needs an ES module)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.CGW_API_KEY,
  baseURL: "https://cloudgpu.app/v1",
});

const resp = await client.chat.completions.create({
  model: "deepseek-v4.1-flash",
  messages: [{ role: "user", content: "Write a TypeScript debounce function." }],
});
console.log(resp.choices[0].message.content);
Enter fullscreen mode Exit fullscreen mode

Tested 2026-10-26: with the openai npm package, this returns normally for deepseek-v4.1-flash.

Aider

According to the official Aider docs ("OpenAI compatible APIs", read 2026-10-26), Aider connects to an OpenAI-compatible endpoint through two environment variables, and the model name gets an openai/ prefix:

# Mac/Linux
export OPENAI_API_BASE=https://cloudgpu.app/v1
export OPENAI_API_KEY="$CGW_API_KEY"
cd /path/to/your/project
aider --model openai/deepseek-v4.1-flash
Enter fullscreen mode Exit fullscreen mode
REM Windows, per the Aider docs (not part of our test): restart the shell after setx
setx OPENAI_API_BASE https://cloudgpu.app/v1
setx OPENAI_API_KEY %CGW_API_KEY%
aider --model openai/deepseek-v4.1-flash
Enter fullscreen mode Exit fullscreen mode

Tested 2026-10-26 with Aider 0.86.2: started with --model openai/deepseek-v4.1-flash and asked to fix a bug in a small add() function, Aider chose the whole edit format by itself, printed "Applied edit", and the fix was correct. openai/deepseek-v4-flash passed the same test, again with whole.

On startup Aider prints:

Warning for openai/deepseek-v4.1-flash: Unknown context window size and costs
Enter fullscreen mode Exit fullscreen mode

The warning doesn't affect use. To skip it, add --no-show-model-warnings:

aider --model openai/deepseek-v4.1-flash --no-show-model-warnings
Enter fullscreen mode Exit fullscreen mode

Limits to know

  • 100 requests per minute per API key and 10,000 requests per day per account. These are public-beta defaults and can be raised on request (API docs).
  • Embeddings are not available yet.
  • The API is in public beta with no SLA.
  • You pay per token from a prepaid balance, with no subscription.

FAQ

Does DeepSeek V4.1 Flash work with the OpenAI SDK?
Yes. Set base_url to https://cloudgpu.app/v1, use a cgw-sk- key and set the model to deepseek-v4.1-flash.

Is deepseek-v4-flash the same as deepseek-v4.1-flash?
No. deepseek-v4-flash is served from the April V4 Flash checkpoint; deepseek-v4.1-flash is the V4.1 Flash model. Both are separate IDs on the API page.

How do I use it in Aider?
Set OPENAI_API_BASE and OPENAI_API_KEY, then start Aider with --model openai/deepseek-v4.1-flash, as the Aider docs describe for OpenAI-compatible APIs. Tested 2026-10-26 with Aider 0.86.2 (it chose the whole edit format by itself).

Where are the current rates?
On the CloudGPU API page. Rates can change, so check there before a large run.

Adapted from "DeepSeek V4 API With USDT or Card: Use the OpenAI SDK" on the CloudGPU blog.

I work on CloudGPU.

Top comments (0)