Skip to content
中文

Quickstart

Install the SDK and set PRAXIS_API_KEY to your API key. Save the Python code as files.py.

The default is https://api.deepraxis.com; override it with the environment variable PRAXIS_API_BASE. The /file/v1 file endpoints are shape-compatible with OpenAI Files, so you can use the openai client directly.

终端窗口
python -m pip install openai
python files.py
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PRAXIS_API_KEY"],
base_url=os.environ.get("PRAXIS_API_BASE", "https://api.deepraxis.com") + "/file/v1",
)
file = client.files.create(
file=("hello.txt", b"Hello, Praxis!\n", "text/plain"),
purpose="user_data",
expires_after={"anchor": "created_at", "seconds": 3600},
)
try:
print("uploaded:", file.id)
files = client.files.list(limit=100)
print("listed:", any(item.id == file.id for item in files))
content = client.files.content(file.id).read()
assert content == b"Hello, Praxis!\n"
print("downloaded:", content.decode().strip())
finally:
deleted = client.files.delete(file.id)
print("deleted:", deleted.deleted)

Expected: an uploaded ID, listed: True, downloaded: Hello, Praxis! and deleted: True. The example deletes its file even if listing or downloading fails.

Upload in the Console

Open Console → 文件 (Files) (/files), click “上传文件” (Upload file) at the top right, and choose a document, image, audio or video file. After the upload the file can be referenced by its file ID in model calls, agent sessions and knowledge bases.

API reference → · Cookbook →