Appearance
万界方舟 Open API 接口文档
接入流程说明
访问万界方舟-模型平台,通过手机号登录,在“模型广场”中,点击模型名称进行模型复制。
获取密钥:登录平台 - 在右上角头像 - “个人中心” - APIKey查看。
模型说明:开放的模型会在“模型广场”中自动分配,其他模型服务需要和商业运营进行授权开通。
所有公开开放的模型完全兼容 openai 接口,私有订制模型见万界方舟外部接口文档。
接口基础信息
Base Url: https://maas-openapi.wanjiedata.com/api
Api Key: 在个人中心 - APIKey栏目授权 APIKEY 获取。
获取模型列表
- 获取已经授权的模型列表。
shell
export API_KEY="<你的 API KEY>"
curl https://maas-openapi.wanjiedata.com/api/v1/models \
-H "Authorization: Bearer $API_KEY"python
import requests
API_KEY = "<你的 API KEY>"
url = "https://maas-openapi.wanjiedata.com/api/v1/models"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())javascript
import axios from 'axios';
const apiKey = '<你的 API KEY>';
async function getModels() {
try {
const response = await axios.get('https://maas-openapi.wanjiedata.com/api/v1/models', {
headers: { Authorization: `Bearer ${apiKey}` }
});
console.log('模型列表:', response.data);
} catch (error) {
console.error('请求失败:', error.response ? error.response.data : error.message);
}
}
getModels();csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <你的 API KEY>");
var response = await client.GetStringAsync("https://maas-openapi.wanjiedata.com/api/v1/models");
Console.WriteLine(response);
}
}响应示例
shell
[
{
"id": "deepseek-v3",
"object": "model",
"created": 1740362631,
"owned_by": "wanjie"
},
{
"id": "deepseek-reasoner",
"object": "model",
"created": 1739017876,
"owned_by": "wanjie"
},
},
},
]python
{
'data': [
{'id': 'qwen3-32b', 'object': 'model', 'created': 1760084423, 'owned_by': 'organization'},
{'id': 'claude-3.7-sonnet-20250219', 'object': 'model', 'created': 1760083578, 'owned_by': 'organization'},
{'id': 'Flux.1-Schnell', 'object': 'model', 'created': 1760083578, 'owned_by': 'organization'},
{'id': 'deepseek-v3', 'object': 'model', 'created': 1760083578, 'owned_by': 'organization'}
],
'object': 'list'
}javascript
模型列表: {
data: [
{id: 'qwen3-32b', object: 'model', created: 1760084423, owned_by: 'organization'},
{id: 'claude-3.7-sonnet-20250219', object: 'model', created: 1760083578, owned_by: 'organization'},
{id: 'Flux.1-Schnell', object: 'model', created: 1760083578, owned_by: 'organization'},
{id: 'deepseek-v3', object: 'model', created: 1760083578, owned_by: 'organization'}
],
object: 'list'
}csharp
d":1760083578,"owned_by":"organization"},
{"id":"gemini-2.5-flash-lite","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"gemini-2.5-flash","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"gemini-2.5-pro","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"claude-sonnet-4-20250514","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"GPT-4o","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"GPT-4.1","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"deepseek-reasoner","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"qwen3-next","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"qwen3-coder","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"kimi-k2","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"qwen3-235b","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"CosyVoice","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"Flux.1-Schnell","object":"model","created":1760083578,"owned_by":"organization"},
{"id":"deepseek-v3","object":"model","created":1760083578,"owned_by":"organization"}],"object":"list"}聊天对话接口
shell
POST /v1/chat/completions非流式请求示例
shell
# 调用聊天对话请求示例
export API_KEY="<你的 API KEY>"
export MODEL="<你的授权模型名称>"
# 授权模型名称:在模型广场列表中模型名称复制名称获取。
curl --location --request POST 'https://maas-openapi.wanjiedata.com/api/v1/chat/completions' \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "'$MODEL'",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'python
import requests
url = "https://maas-openapi.wanjiedata.com/api/v1/chat/completions"
api_key = "<你的 API KEY>"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
data = {
"model": "<你的授权模型名称>",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
}
response = requests.post(url, headers=headers, json=data)
response_json = response.json()
assistant_message = response_json['choices'][0]['message']['content']
print(assistant_message)javascript
import axios from 'axios';
const apiKey = '<你的 API KEY>';
const model = '<你的授权模型名称>';
const url = 'https://maas-openapi.wanjiedata.com/api/v1/chat/completions';
async function testConnection() {
try {
const response = await axios.post(url, {
model,
messages: [
{ role: 'user', content: 'Hello!' }
]
}, {
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
console.log(response.data.choices[0].message.content);
console.log('API 连接成功');
} catch (error) {
console.error('API 连接失败:', error.response?.data || error.message);
}
}
testConnection();csharp
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class P {
static async Task Main() {
var c = new HttpClient();
c.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");
var d = new StringContent(@"{
""model"":""<MODEL>"",
""messages"":[{""role"":""user"",""content"":""Hello!""}],
""stream"":false
}", Encoding.UTF8, "application/json");
var r = await c.PostAsync("https://maas-openapi.wanjiedata.com/api/v1/chat/completions", d);
System.Console.WriteLine(await r.Content.ReadAsStringAsync());
}
}非流式响应示例
shell
{
"id": "chatcmpl-xxxxxx",
"object": "chat.completion",
"created": 1760336462,
"model": "deepseek-reasoner",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! 😊 How can I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 228,
"total_tokens": 236
}
}python
Hello! 😊 How can I assist you today?javascript
Hello! 😊 How can I assist you today? Whether you have a question, need help with something, or just want to chat, I'm here for you!
API 连接成功csharp
{
"id":"chatcmpl-187830d79894458aa702fd592b109d4b",
"object":"chat.completion","created":1762412451,
"model":"deepseek-reasoner","choices":[{"index":0,"message":{"role":"assistant",
"content":"\nHi there! 😊 \nHow are you doing today? What can I help you with? 😊",
"tool_calls":[]},"finish_reason":"stop"}],
"usage":{"prompt_tokens":5,"completion_tokens":186,"total_tokens":191}
}流式请求示例
shell
# 调用聊天对话请求示例
export API_KEY="<你的 API KEY>"
export MODEL="<你的授权模型名称>"
# 授权模型名称:在授权模型列表中模型名称复制名称获取。
curl --location --request POST 'https://maas-openapi.wanjiedata.com/api/v1/chat/completions' \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "'$MODEL'",
"messages": [{"role": "user", "content": "请用一句话介绍自己"}],
"stream": true
}'python
import requests
API_KEY = "<你的 API KEY>"
MODEL = "<你的授权模型名称>"
url = 'https://maas-openapi.wanjiedata.com/api/v1/chat/completions'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
data = {
"model": MODEL,
"messages": [{"role": "user", "content": "请用一句话介绍自己"}],
"stream": True
}
response = requests.post(url, headers=headers, json=data)
print(response.text)javascript
fetch('https://maas-openapi.wanjiedata.com/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer <你的 API KEY>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: '<你的授权模型名称>',
messages: [{ role: 'user', content: '请用一句话介绍自己' }],
stream: true
})
})
.then(res => res.text())
.then(console.log);csharp
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class P {
static async Task Main() {
var c = new HttpClient();
c.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");
var d = new StringContent(@"{
""model"":""<MODEL>"",
""messages"":[{""role"":""user"",""content"":""请用一句话介绍自己""}],
""stream"":true
}", Encoding.UTF8, "application/json");
var r = await c.PostAsync("https://maas-openapi.wanjiedata.com/api/v1/chat/completions", d);
System.Console.WriteLine(await r.Content.ReadAsStringAsync());
}
}流式响应示例
shell
{
"id": "chatcmpl-5cb3566f274045d29a948339258bf4fe",
"object": "chat.completion.chunk",
"created": 1762307854,
"model": "deepseek-reasoner",
"system_fingerprint": "fp_931335",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": null,
"reasoning_content": "",
...
...
"refusal": null,
"tool_calls": null
},
"logprobs": null,
"finish_reason": null
}
],
"usage": null
}
[DONE
]python
id: 0
data: {"id":"chatcmpl-d9a6e351096347aba63d25ecb858c1ab","object":"chat.completion.chunk","created":1762307411,"model":"deepseek-reasoner","system_fingerprint":"fp_102727","choices":[{"index":0,"delta":{"role":"assistant","content":null,"reasoning_content":"","refusal":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
id: 1
data: {"id":"chatcmpl-d9a6e351096347aba63d25ecb858c1ab","object":"chat.completion.chunk","created":1762307411,"model":"deepseek-reasoner","system_fingerprint":"fp_082062","choices":[{"index":0,"delta":{"role":"assistant","content":null,"reasoning_content":"\n","refusal":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
...
id: 214
data: [DONE]javascript
id: 0
data: {"id":"chatcmpl-21162e8a7db647c4b6322a08a8642b6a","object":"chat.completion.chunk","created":1762307630,"model":"deepseek-reasoner","system_fingerprint":"fp_305980","choices":[{"index":0,"delta":{"role":"assistant","content":null,"reasoning_content":"","refusal":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
id: 1
data: {"id":"chatcmpl-21162e8a7db647c4b6322a08a8642b6a","object":"chat.completion.chunk","created":1762307630,"model":"deepseek-reasoner","system_fingerprint":"fp_628390","choices":[{"index":0,"delta":{"role":"assistant","content":null,"reasoning_content":"\n","refusal":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
...
id: 214
data: [DONE]csharp
id: 0
data: {"id":"chatcmpl-84478138cdd54db8a6fe08ca6303d988","object":"chat.completion.chunk","created":1762413495,"model":"deepseek-reasoner","system_fingerprint":"fp_397373","choices":[{"index":0,"delta":{"role":"assistant","content":null,"reasoning_content":"","refusal":null,"tool_calls":null},"logprobs":null,"finish_reason":null}],"usage":null}
...
id: 213
data: {"id":"chatcmpl-84478138cdd54db8a6fe08ca6303d988","object":"chat.completion.chunk","created":1762413495,"model":"deepseek-reasoner","system_fingerprint":"fp_065818","choices":[],"usage":{"prompt_tokens":8,"completion_tokens":214,"total_tokens":222,"prompt_tokens_details":null,"completion_tokens_details":null}}
id: 214
data: [DONE]聊天对话接口参数说明见 OpenAI API Chat completions
文字转语音接口
- 支持的模型:CosyVoice
shell
POST /v1/audio/speechshell
export API_KEY="<你的 API KEY>"
# 授权文字转语音模型名称:在授权模型列表中模型名称复制名称获取。
export MODEL="<你的授权文字转语音模型名称>"
curl --location --request POST 'https://maas-openapi.wanjiedata.com/api/v1/audio/speech' \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"input": "您好,我是文字转语音助手,一个由万界数据训练的语音合成模型,你可以尝试输入一段文字,将帮您把这段文字转换为语音输出。",
"model": "'$MODEL'",
"voice": "普通话",
"responseFormat": "mp3",
"speed": 1.0
}' \
--output output.mp3python
import requests
API_KEY = "<你的 API KEY>"
MODEL = "<你的授权文字转语音模型名称>"
url = "https://maas-openapi.wanjiedata.com/api/v1/audio/speech"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
payload = {
"input": "您好,我是文字转语音助手,一个由万界数据训练的语音合成模型,你可以尝试输入一段文字,将帮您把这段文字转换为语音输出。",
"model": MODEL,
"voice": "普通话",
"responseFormat": "mp3",
"speed": 1.0
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
with open("output.mp3", "wb") as f:
f.write(response.content)
print("音频已保存为 output.mp3")
else:
print("请求失败:", response.status_code)
print(response.text)javascript
import axios from 'axios';
import fs from 'fs';
const apiKey = '<你的 API KEY>';
const model = '<你的授权文字转语音模型名称>';
const url = 'https://maas-openapi.wanjiedata.com/api/v1/audio/speech';
const inputText = '你好,我是文字转语音助手!';
async function textToSpeech() {
try {
const response = await axios.post(url, {
input: inputText,
model: model,
voice: '普通话',
responseFormat: 'mp3',
speed: 1.0
}, {
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
responseType: 'arraybuffer'
});
fs.writeFileSync('output.mp3', response.data);
console.log('MP3文件已保存为 output.mp3');
} catch (error) {
console.error('请求失败:', error.response?.data || error.message);
}
}
textToSpeech();csharp
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.IO;
class P {
static async Task Main() {
var c = new HttpClient();
c.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");
var d = new StringContent(@"{
""input"":""您好,我是文字转语音助手,一个由万界数据训练的语音合成模型,你可以尝试输入一段文字,将帮您把这段文字转换为语音输出。"",
""model"":""<MODEL>"",
""voice"":""普通话"",
""responseFormat"":""mp3"",
""speed"":1.0
}", Encoding.UTF8, "application/json");
var r = await c.PostAsync("https://maas-openapi.wanjiedata.com/api/v1/audio/speech", d);
var bytes = await r.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("output.mp3", bytes);
}
}响应示例
shell
# 文件 output.mp3 已保存为当前目录python
音频已保存为 output.mp3javascript
MP3文件已保存为 output.mp3csharp
Directory: D:\C#\work\ModelProject
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2025/11/6 15:23 176910 output.mp3文转语音接口参数说明见 OpenAI API Create speech
文生图接口
- 支持的模型:Flux.1-Schnell(该模型提示词只支持英文)
shell
POST /v1/images/generationsshell
export API_KEY="<你的 API KEY>"
export MODEL="<你的授权文生图模型名称>"
curl --location --request POST 'https://maas-openapi.wanjiedata.com/api/v1/images/generations' \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "'$MODEL'",
"prompt": "graphic of a Harley Davidson bike",
"n": 1,
"size": "1024x1024",
"responseFormat": "url",
"quality": "standard",
"style": "vivid"
}'python
import requests
API_KEY = "<你的 API KEY>"
MODEL = "<你的授权文生图模型名称>"
url = "https://maas-openapi.wanjiedata.com/api/v1/images/generations"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
payload = {
"model": MODEL,
"prompt": "graphic of a Harley Davidson bike",
"n": 1,
"size": "1024x1024",
"responseFormat": "url",
"quality": "standard",
"style": "vivid"
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
result = response.json()
print(result)
else:
print("请求失败:", response.status_code)
print(response.text)javascript
import axios from 'axios';
const apiKey = '<你的 API KEY>';
const model = '<你的授权文生图模型名称>';
const url = 'https://maas-openapi.wanjiedata.com/api/v1/images/generations';
async function generateImage() {
const headers = {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
const data = {
model,
prompt: 'graphic of a Harley Davidson bike',
n: 1,
size: '1024x1024',
responseFormat: 'url'
};
try {
const res = await axios.post(url, data, { headers });
console.log(res.data.data[0].url);
} catch (err) {
console.error('请求失败:', err.message);
}
}
generateImage();csharp
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class P {
static async Task Main() {
var c = new HttpClient();
c.DefaultRequestHeaders.Add("Authorization", "Bearer <API_KEY>");
var d = new StringContent(@"{
""model"":""<MODEL>"",
""prompt"":""graphic of a Harley Davidson bike"",
""n"":1,
""size"":""1024x1024"",
""responseFormat"":""url"",
""quality"":""standard"",
""style"":""vivid""
}", Encoding.UTF8, "application/json");
var r = await c.PostAsync("https://maas-openapi.wanjiedata.com/api/v1/images/generations", d);
System.Console.WriteLine(await r.Content.ReadAsStringAsync());
}
}响应示例
shell
{
"created": 1762221608,
"data": [
{
"url": "https://rgw.wanjiedata.com/maas-public-bucket/2025/11/04/c3fe6bdd3a601f90c4d1e33e961e064f.jpg"
}
],
"usage": {
"input_tokens_details": {}
}
}python
{
'created': 1762220795,
'data': [{'url': 'https://rgw.wanjiedata.com/maas-public-bucket/2025/11/04/a920b1331c7c5676624e38cbc10d8b43.jpg'}],
'usage': {'input_tokens_details': {}
}
}javascript
https://rgw.wanjiedata.com/maas-public-bucket/2025/11/04/0d4e5bc27fe7b76a1544a36d75f4c1da.jpgcsharp
{"created":1762414008,"data":[{"url":"https://rgw.wanjiedata.com/maas-public-bucket/2025/11/06/6c6eaaa374eb4be4a629b3adff530412.jpg"}],"usage":{"input_tokens_details":{}}}