快速开始

本平台为自部署的 Qwen3.8-Flash-Next(125B-A6B,原生 262K 上下文,支持视觉)提供公网接入与 API Key 管理。

OpenAI 兼容https://api.cislunarspace.cn/v1
Anthropic 兼容https://api.cislunarspace.cn
模型名qwen3.8-flash(Anthropic 侧也可用 claude-sonnet-4-5 等别名)
鉴权OpenAI: Authorization: Bearer sk-cs-xxx Anthropic: x-api-key: sk-cs-xxx
上下文上限262,144 tokens / 会话(超出返回 400)
视觉支持单图 / 多图输入(image_url)

OpenAI 兼容(Python)

from openai import OpenAI

client = OpenAI(
    base_url="https://api.cislunarspace.cn/v1",
    api_key="sk-cs-你的key",
)

completion = client.chat.completions.create(
    model="qwen3.8-flash",
    messages=[{"role": "user", "content": "你好"}],
    stream=True,
)
for chunk in completion:
    if chunk.choices:
        delta = chunk.choices[0].delta
        # 思维链在 reasoning_content,最终回答在 content
        if getattr(delta, "reasoning_content", None):
            print(delta.reasoning_content, end="")
        elif delta.content:
            print(delta.content, end="")

curl

curl https://api.cislunarspace.cn/v1/chat/completions \
  -H "Authorization: Bearer sk-cs-你的key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-flash",
    "messages": [{"role": "user", "content": "你好"}]
  }'

Anthropic 兼容(Python)

import anthropic

client = anthropic.Anthropic(
    base_url="https://api.cislunarspace.cn",
    api_key="sk-cs-你的key",
)

message = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=2048,
    messages=[{"role": "user", "content": "你好"}],
)
print(message.content[0].text)

思考模式与采样参数

默认开启 thinking(思维链经 reasoning_content 返回,多轮保留)。

模式建议参数
thinking(默认) temperature=1.0, top_p=0.95, top_k=20, presence_penalty=0.0
非 thinking temperature=0.7, top_p=0.8, top_k=20, presence_penalty=1.5
请求体加 "chat_template_kwargs": {"enable_thinking": false} 关闭
client.chat.completions.create(
    model="qwen3.8-flash",
    messages=[{"role": "user", "content": "2+2=?"}],
    temperature=0.7, top_p=0.8, presence_penalty=1.5,
    extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)

pi / Claude Code 类客户端

pi 编辑器在 ~/.pi/agent/models.json 中加入:

{
  "providers": {
    "qwen38-flash": {
      "baseUrl": "https://api.cislunarspace.cn/v1",
      "api": "openai-completions",
      "apiKey": "sk-cs-你的key",
      "compat": {
        "supportsDeveloperRole": false,
        "thinkingFormat": "qwen-chat-template"
      },
      "models": [{
        "id": "qwen3.8-flash",
        "name": "Qwen3.8 Flash Next",
        "reasoning": true,
        "input": ["text", "image"],
        "contextWindow": 262144,
        "maxTokens": 131072,
        "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
        "samplingParams": {
          "temperature": 1.0, "top_p": 0.95,
          "top_k": 20, "min_p": 0.0, "presence_penalty": 0.0
        }
      }]
    }
  }
}

常见问题

401 Invalid platform API key — Key 错误、已吊销,或没加 Bearer 前缀。到控制台重新生成。

429 Too Many Requests — 触发了每 IP 限速(保护后端 4 并发槽),稍等片刻重试。

400 上下文超限 — 单会话输入 + 输出不能超过 262,144 tokens,超长会话请开新会话。

Key 安全 — Key 明文只在生成时显示一次,平台只存哈希。泄露后请在控制台立即吊销。