API 调试沙箱

OpenAI 兼容

示例代码

// 使用 Fetch API 调用
fetch('/api/gateway/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    model: 'qwen-turbo',
    messages: [
      { role: 'system', content: '你是一个智能助手' },
      { role: 'user', content: '你好' }
    ],
    temperature: 0.7,
    max_tokens: 1000
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));