Call DeepSeek with the OpenAI Python SDK
This example sends a short greeting to DeepSeek through SailQ and prints the reply. You need Python, a SailQ API key and a funded SailQ balance.
Prepare your key and Python environment
Create an API key · Top up credits
In a new project directory on macOS or Linux, run these commands. Keep the environment active for the next step.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install openai
Send the first chat request
Save the following as main.py. It reads SAILQ_API_KEY if set, or asks for the key privately in your terminal.
import os
from getpass import getpass
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("SAILQ_API_KEY") or getpass("SailQ API key: "),
base_url="https://api.sailq.ai/v1",
)
reply = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(reply.choices[0].message.content)
python main.py
Check the reply and charge
You should see a greeting in your terminal. Open Usage to find the model ID, token counts and settled USD charge for that request.
Open usage logs · Estimate a monthly workload
If authentication fails, check that the key is active in your SailQ workspace. For a model error, copy an available DeepSeek ID from the catalog. For an insufficient balance, check your wallet.