The Python Server SDK is also commonly used alongside a small backend service that implements your own model logic behind a chat-completions-style endpoint, so an assistant's model provider can point at your server instead of a hosted one. A minimal Flask example:
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/chat/completions", methods=["POST"])
def chat_completions():
payload = request.get_json()
messages = payload.get("messages", [])
# Your own model / business logic goes here
reply = "This is a custom response from your own model endpoint."
return jsonify({
"choices": [
{"message": {"role": "assistant", "content": reply}}
]
})
if __name__ == "__main__":
app.run(port=5000)
Point your assistant's model configuration at this endpoint's public URL to route conversation turns through your own logic instead of a hosted model.