Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions demo/serving_dinfer_openai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Demo of dinfer openai serving

## Serving

```bash
python3 serving_dinfer_openai.py
```

## Client

```bash
date && curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 12345678" -N -d '{"messages": [{"role": "user", "content": "你好, 我是小明"}], "stream": false}' http://0.0.0.0:48000/v1/chat/completions && date

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The curl command includes a hardcoded bearer token (12345678). While this is a demo, it's a bad practice to hardcode credentials, even dummy ones, in documentation. It can lead to security vulnerabilities if this pattern is copied elsewhere. It's better to use a placeholder to indicate that a user should provide their own token.

Suggested change
date && curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 12345678" -N -d '{"messages": [{"role": "user", "content": "你好, 我是小明"}], "stream": false}' http://0.0.0.0:48000/v1/chat/completions && date
date && curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <YOUR_API_KEY>" -N -d '{"messages": [{"role": "user", "content": "你好, 我是小明"}], "stream": false}' http://0.0.0.0:48000/v1/chat/completions && date

```