Quickstart
Call deepseek-flash with a cloud API key, read the amount charged, and find the record for that call. This example incurs a small charge.
1. Prepare your key and terminal
Open Console → API Keys, click “创建 Key” (Create Key), enter a name, and create the key. Securely inject it into the current terminal as PRAXIS_API_KEY. Never put it in code or logs. You can use an existing key.
Install Python 3.10+ and uv. Run in a macOS / Linux terminal:
test -n "${PRAXIS_API_KEY:-}"Expected: exit code 0. Exit code 1 means the variable is missing; set it before continuing. Examples default to https://api.deepraxis.com. To switch environments, set PRAXIS_API_BASE to the API origin without a trailing slash or API path.
2. Send a request and read its cost
Save as quickstart.py. From that directory, run uv run -q --no-project --with openai --with anthropic --with google-genai python quickstart.py.
import jsonimport osfrom pathlib import Pathfrom openai import OpenAI
client = OpenAI( api_key=os.environ["PRAXIS_API_KEY"], base_url=os.environ.get("PRAXIS_API_BASE", "https://api.deepraxis.com") + "/openai/v1", timeout=90.0, max_retries=0,)raw = client.chat.completions.with_raw_response.create( model="deepseek-flash", messages=[{"role": "user", "content": "Reply with exactly: Hello Praxis."}], max_tokens=256,)reply = raw.parse()usage = reply.usage.model_dump()request_id = raw.headers.get("x-request-id")generation_id = raw.headers.get("x-praxis-generation-id")assert raw.status_code == 200 and reply.choices[0].message.contentassert request_id and generation_idassert isinstance(usage.get("cost"), (int, float)) and usage["cost"] >= 0print(reply.choices[0].message.content)print("usage:", usage)print("X-Request-Id:", request_id)print("X-Praxis-Generation-Id:", generation_id)Path("quickstart-result.json").write_text(json.dumps({ "request_id": request_id, "generation_id": generation_id, "cost": usage["cost"],}))Expected: exit code 0, a nonempty reply (usually Hello Praxis.), usage, two IDs, and a new quickstart-result.json. This file contains only the call IDs and cost, never the key.
usage includes input and output token counts. usage.cost is the amount actually charged in USD, not a price per million tokens. A missing cost does not mean zero. See Chat Completions API for field definitions.
3. Find this call
Open Console → 模型 (Models) → 调用日志 (Call logs). Paste the previous step’s X-Request-Id into “按 X-Request-Id / Generation ID 查找” and press Enter.
Expected: the deepseek-flash call appears with its status, usage, and cost. Records can take a few seconds to appear. Use the key’s account and environment, with a time range covering the call.
For equivalent verification without a browser, save the following as verify-generation.py. In the same directory, run uv run -q --no-project --with openai --with anthropic --with google-genai python verify-generation.py.
import jsonimport osimport timefrom decimal import Decimalfrom pathlib import Pathimport httpx
saved = json.loads(Path("quickstart-result.json").read_text())base = os.environ.get("PRAXIS_API_BASE", "https://api.deepraxis.com")with httpx.Client(timeout=60.0) as client: for attempt in range(10): response = client.get( base + "/model/v1/generation", params={"id": saved["generation_id"]}, headers={"Authorization": "Bearer " + os.environ["PRAXIS_API_KEY"]}, ) if response.status_code != 404: break time.sleep(3) response.raise_for_status() record = response.json() assert record["id"] == saved["generation_id"] assert record["model"] == "deepseek-flash" assert abs(Decimal(str(record["cost"])) - Decimal(str(saved["cost"]))) <= Decimal("0.0000005") print("Verified generation:", record["id"]) print("cost:", record["cost"]) print("X-Request-Id:", response.headers.get("x-request-id"))Expected: exit code 0, Verified generation, and the cost recorded to six decimal places in USD; the script allows for that rounding. This query uses X-Praxis-Generation-Id, not X-Request-Id or the response body’s id. See the generation record API.
Troubleshooting
404when querying a record: the script retries every 3 seconds, up to 10 attempts, while the record becomes available. If it still fails, keep both IDs, check the key, environment, and generation ID belong to this call, then query again.Model "gpt-4o" does not exist.: model IDs are not automatically mapped. Usedeepseek-flashor an ID from the catalog.
Next, try streaming or tool calling.