-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
`from fastapi import FastAPI
import boto3
import json
import time
import uuid
app = FastAPI()
@app.post("/v1/chat/completions")
async def chat_completions():
with open('./openai.json', 'r') as file:
data = json.load(file)
return data`
{ "id": "chatcmpl-Ce5Cfb4uESFgq7jsEBcn2ZchvZhab", "object": "chat.completion", "created": 1763669157, "model": "gpt-5-nano-2025-08-07", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hi there! How can I help today? I can answer questions, explain concepts, help with writing or editing, code, brainstorm ideas, translate, or plan tasks. Tell me what you’d like to do.", "refusal": null, "annotations": [] }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 8, "completion_tokens": 244, "total_tokens": 252, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 192, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0 } }, "service_tier": "default", "system_fingerprint": null }
I directly used FastAPI to return the JSON, but the UI doesn't show the message appropriately.
