中文 ▾
领取试用密钥

Cursor API 文档与快速入门

这款无审查的LLM采用OpenAI兼容API运行,允许您接入自己的Cursor API密钥,或生成新密钥以实现直接集成。

认证与基础 URL 设置

首先将客户端指向基础 URL https://api.cursorapi.cc/v1 并在授权标头中传递您的密钥。系统使用标准的 Bearer 令牌认证,因此一旦更新端点,任何 OpenAI SDK 均可开箱即用。

向 /v1/chat/completions 发送请求

向 POST /v1/chat/completions 将模型 ID 设置为 uncensored. 该模型针对合法成人内容无审查地回答,让您完全控制输出。您只为实际的 token 使用付费,错误是免费的,确保您不会因静默失败而浪费信用额度。

cURL

curl https://api.cursorapi.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Summarize the key differences between the two models."}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.cursorapi.cc/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.cursorapi.cc/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

流式传输

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

即时获取 API 密钥

注册,复制密钥,更新您的基础 URL。简单的设置。

领取试用密钥