Alibaba/qwen-flash-character
qwen-flash-character
Qwen Flash Character API를 무료로 사용해 보고, 빠른 페르소나 중심 텍스트 역할극, 프로필, 장기 기억, 확장 가능한 대화 워크플로를 구축하세요. 캐릭터 테스트, 챗봇, Alibaba LLM 앱에 적합합니다.
Text Chat
API 예제
제출 예제
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
Accept: 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'qwen-flash-character',
messages: [
{
role: 'system',
content: 'You are a calm library assistant who speaks briefly and vividly.'
},
{
role: 'user',
content: 'Introduce yourself in three sentences.'
}
],
stream: true,
max_tokens: 800,
temperature: 0.7,
seed: 12345
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
let assistantText = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const frames = buffer.split('\n\n');
buffer = frames.pop() || '';
for (const frame of frames) {
const lines = frame.split('\n').filter(Boolean);
let eventName = 'message';
const dataLines = [];
for (const line of lines) {
if (line.startsWith('event:')) {
eventName = line.slice(6).trim();
} else if (line.startsWith('data:')) {
dataLines.push(line.replace(/^data:\s*/, ''));
}
}
const raw = dataLines.join('\n').trim();
if (raw === '[DONE]') {
console.log('\nFinal text:', assistantText);
continue;
}
let payload;
try {
payload = JSON.parse(raw);
} catch {
continue;
}
if (eventName === 'error' || payload.error) {
const msg = payload.error?.message ?? payload.message ?? 'Chat request failed';
throw new Error(msg);
}
const delta = payload.choices?.[0]?.delta;
if (delta?.content) {
assistantText += delta.content;
console.log(assistantText);
}
}
}
제출 예제
import json
import requests
response = requests.post(
'https://api.flaq.ai/api/v1/chat/completions',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json',
},
json={
'model': 'qwen-flash-character',
'messages': [
{
'role': 'system',
'content': 'You are a calm library assistant who speaks briefly and vividly.',
},
{
'role': 'user',
'content': 'Introduce yourself in three sentences.',
},
],
'stream': True,
'max_tokens': 800,
'temperature': 0.7,
'seed': 12345,
},
stream=True,
)
response.raise_for_status()
event_name = 'message'
assistant_text = ''
for raw_line in response.iter_lines(decode_unicode=True):
if not raw_line:
event_name = 'message'
continue
if raw_line.startswith('event:'):
event_name = raw_line.replace('event:', '', 1).strip()
continue
if raw_line.startswith('data:'):
raw_data = raw_line.replace('data:', '', 1).strip()
if raw_data == '[DONE]':
print('\nFinal text:', assistant_text)
continue
payload = json.loads(raw_data)
if event_name == 'error' or payload.get('error'):
error = payload.get('error') or payload
raise RuntimeError(error.get('message', 'Chat request failed'))
choices = payload.get('choices') or []
if choices:
delta = choices[0].get('delta') or {}
content = delta.get('content')
if content:
assistant_text += content
print(content, end='', flush=True)
제출 예제
curl -N -X POST "https://api.flaq.ai/api/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-flash-character",
"messages": [
{
"role": "system",
"content": "You are a calm library assistant who speaks briefly and vividly."
},
{
"role": "user",
"content": "Introduce yourself in three sentences."
}
],
"stream": true,
"max_tokens": 800,
"temperature": 0.7,
"seed": 12345
}'
Qwen Flash Character 가격
| 매개변수 | 가격 | 원래 가격 | 할인 |
|---|
README
빠르고 합리적인 Qwen Flash Character API (Alibaba 캐릭터 롤플레이 LLM)
Flaq AI의 Qwen Flash Character API는 채팅 제품, 컴패니언 앱, 스토리텔링 시스템, 페르소나 중심 워크플로를 위해 빠르고 비용 효율적인 Alibaba 캐릭터 롤플레이 LLM 액세스를 제공합니다. 이 합리적인 Qwen API 통합은 프롬프트 기반 톤, 프로필 설정, 대화 컨텍스트를 지원하면서 개발자가 캐릭터 일관 텍스트 응답을 빠르게 생성하도록 돕습니다. 빠른 반복, 대량 대화 테스트, 확장 가능한 롤플레이 기능을 위해 설계되었습니다.
Qwen Flash Character API의 주요 기능
- 빠른 캐릭터 대화: 프로토타입, 롤플레이 앱, 어시스턴트, 대량 대화 워크플로를 위해 페르소나에 맞춘 텍스트 응답을 빠르게 생성합니다.
- 비용 효율적인 API 액세스: 맞춤형 모델 인프라를 유지하지 않고 Qwen Flash Character로 합리적인 캐릭터 채팅을 사용합니다.
- 프롬프트 기반 페르소나 제어:
system메시지를 통해 캐릭터 배경, 톤, 말투, 응답 동작을 정의하고, 장기 메모리 모드에서는profile을 사용합니다. - 일관된 대화 방향: 여러 턴에 걸쳐 인식 가능한 캐릭터 특성과 세션 컨텍스트에 맞춰 대화를 유지합니다.
- 장기 메모리 지원:
enable_long_term_memory,profile, 사용자 정의x-session값을 사용해 관련 대화 간에 메모리를 재사용합니다. - 그룹 채팅 시뮬레이션: 메시지 내용에 화자 이름을 직접 작성하고
partial: true가 포함된 assistant 접두어를 사용해 여러 화자 장면을 시뮬레이션합니다. - 유연한 롤플레이 범위: 컴패니언, 스토리 캐릭터, 훈련 페르소나, 지원 봇, 인터랙티브 픽션 경험을 구축합니다.
- 개발자 친화적 통합: Flaq AI의 관리형 Alibaba API 라우트를 통해 제품에 빠른 캐릭터 LLM 워크플로를 추가합니다.
Flaq AI에서 빠른 캐릭터 채팅용 Qwen Flash Character API를 사용하는 방법
- 입력: 채팅 메시지, 시스템 페르소나 지시, 선택적 장기 메모리 설정, 선택적 assistant
partial이어쓰기 메시지. - 출력: 캐릭터 대화, 롤플레이, 스토리텔링, 페르소나 중심 채팅 경험을 위한 텍스트 응답.
- 대화 제어: 정체성, 톤, 메모리 동작, 응답 스타일, 단기 컨텍스트, 장기 세션 연속성에 대한 프롬프트 기반 지시를 지원합니다.
- 기능: Qwen Flash Character API 통합을 통해 빠른 롤플레이 대화, 캐릭터 일관 텍스트 생성, 페르소나 채팅, 그룹 채팅 시뮬레이션, assistant 부분 이어쓰기, 인터랙티브 스토리텔링, 확장 가능한 캐릭터 워크플로를 지원합니다.
그룹 채팅 시뮬레이션에서는 화자 이름을 profile에서 추론하지 않습니다. 각 메시지 시작 부분에 이름을 직접 추가한 다음, Ling Lu: 같은 마지막 assistant 메시지를 추가하고 partial: true를 설정하면 모델이 해당 캐릭터로 계속 답합니다.
Qwen Flash Character API 통합의 최적 사용 사례
- 빠른 대화 반복: 최종 페르소나 방향을 선택하기 전에 캐릭터 목소리, 프로필, 상호작용 스타일을 빠르게 테스트합니다.
- 컴패니언 및 롤플레이 앱: 빠른 캐릭터 채팅, 가벼운 메모리, 합리적인 텍스트 생성이 필요한 사용자 대상 제품을 구동합니다.
- 스토리 및 게임 프로토타이핑: 초기 제품 개발을 위해 대화, NPC 동작, 분기 장면, 캐릭터 상호작용을 탐색합니다.
- 훈련 및 시뮬레이션: 언어 학습, 코칭, 지원 훈련, 시나리오 리허설을 위한 역할 기반 대화 연습을 만듭니다.
- 대량 채팅 워크플로: 속도와 합리적인 비용이 중요한 확장 가능한 롤플레이 및 페르소나 채팅 시스템을 지원합니다.
참고 프롬프트, 캐릭터 프로필, 메모리 사용, 생성 텍스트가 Alibaba 및 Flaq AI 안전 요구사항을 준수하는지 확인하세요. 오류가 발생하면 요청, 프로필 또는 생성 설정을 수정한 뒤 다시 시도하세요.
Qwen Flash Character와 경쟁 제품 비교: 비교 분석
- Qwen Flash Character vs. Qwen Plus Character
Qwen Plus Character는 더 풍부한 롤플레이와 더 세련된 페르소나 중심 응답을 지향합니다. Qwen Flash Character는 반복이 많은 워크플로를 위해 빠르고 합리적인 대화를 우선합니다. - Qwen Flash Character vs. GPT Character Chat GPT 모델은 폭넓은 범용 대화를 지원합니다. Qwen Flash Character는 관리형 API 액세스로 빠른 Alibaba 기반 캐릭터 채팅 워크플로에 집중합니다.
- Qwen Flash Character vs. Claude Character Chat Claude는 세심한 긴 형식의 대화에 유용합니다. Qwen Flash Character는 확장 가능한 롤플레이 및 컴패니언 채팅 제품을 위해 더 빠르고 낮은 비용의 경로를 제공합니다.
- Qwen Flash Character vs. Kimi Text-to-Text Kimi는 일반적인 LLM 추론과 글쓰기에 유용합니다. Qwen Flash Character는 캐릭터 페르소나 동작, 롤플레이 응답 스타일, 대량 대화에 집중합니다.
- Qwen Flash Character vs. General Qwen Chat 일반 Qwen 채팅 모델은 폭넓은 텍스트 작업을 다룹니다. Qwen Flash Character는 속도, 합리적인 비용, 캐릭터 일관성이 중요한 페르소나 주도 대화에 최적화되어 있습니다.