### Quick Start cURL Example Source: https://platform.sensenova.cn/docs A basic cURL command to get a completion from the SenseNova API. Ensure your SENSENOVA_API_KEY is set as an environment variable. ```shell curl https://token.sensenova.cn/v1/chat/completions \ -H "Authorization: Bearer $SENSENOVA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "sensenova-6.7-flash-lite", "messages": [{"role": "user", "content": "Hello!"}] }' ``` -------------------------------- ### Run Hermes Agent Setup Source: https://platform.sensenova.cn/docs Initiate the interactive setup wizard for Hermes Agent to configure models and providers. ```bash hermes setup ``` -------------------------------- ### Install OpenCode AI Source: https://platform.sensenova.cn/docs Install the OpenCode AI command-line tool globally using npm. Ensure Node.js v18.0 or higher is installed. ```bash npm install -g opencode-ai ``` -------------------------------- ### Start OpenCode Source: https://platform.sensenova.cn/docs Launch the OpenCode AI command-line interface. ```bash opencode ``` -------------------------------- ### Verify OpenCode Installation Source: https://platform.sensenova.cn/docs Check the installed version of OpenCode AI. ```bash opencode -v ``` -------------------------------- ### Install OpenClaw with npm Source: https://platform.sensenova.cn/docs Install OpenClaw globally via npm and set up the background daemon. Requires Node.js 24 or 22.14+. ```bash npm install -g openclaw@latest openclaw onboard --install-daemon ``` -------------------------------- ### Configure OpenClaw with SenseNova Source: https://platform.sensenova.cn/docs Example interactive prompts for configuring OpenClaw with a custom provider (SenseNova) using an OpenAI-compatible endpoint. ```bash ◇ Setup mode │ QuickStart │ ◇ Model/auth provider │ Custom Provider │ ◇ API Base URL │ https://token.sensenova.cn/v1 │ ◇ How do you want to provide this API key? │ Paste API key now │ ◇ API Key │ $SENSENOVA_API_KEY(您的 SenseNova API Key) │ ◇ Endpoint compatibility │ OpenAI-compatible │ ◇ Model ID │ sensenova-6.7-flash-lite ``` -------------------------------- ### Generate Infographic with SenseNova U1 Fast (Node.js) Source: https://platform.sensenova.cn/docs Example Node.js code to generate an infographic. This snippet shows how to make a POST request to the image generation endpoint using 'node-fetch'. Ensure you have 'node-fetch' installed and your API key is set as an environment variable. ```Node.js const fetch = require('node-fetch'); const apiKey = process.env.SENSENOVA_API_KEY; const url = 'https://token.sensenova.cn/v1/images/generations'; const headers = { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }; const data = { "model": "sensenova-u1-fast", "prompt": "这张信息图以柔和的粉色、淡黄色和浅蓝色为主色调,采用了极具亲和力的可爱卡通风格(包含猫咪、拟人化表情等元素)。整体排版从左到右分为三个主要区块,分别介绍核心能力、工作流程和重要规则。图表的左上角是醒目的主标题“信息图生成专家”,其下方紧跟副标题:“帮助用户将复杂信息转化为清晰易懂的视觉呈现”。以下是图表中各区块的详细结构和全部文字内容:1. 左侧区块:核心能力与专家提示。该区块主要列出了三项核心能力,并附带了一条专家提示。核心能力(由上至下排列,每项均配有可爱的拟人化图标):1. 联网搜索功能:查询最新网络信息(图标为一个带有猫耳、拿着放大镜的拟人化地球)。2. 网页内容读取功能:获取指定网页的详细内容(图标为一个戴着眼镜、正在阅读的拟人化纸卷)。3. 信息图生成功能:根据文字描述生成专业的信息图(图标为一个手持柱状图的可爱机器人)。专家提示(位于该区块底部,背景为黄色便利贴样式,右上角有一只探出纸箱的猫咪图标):文本内容:“熟练结合搜索与读取工具,最大化提升视觉数据的信息密度。”2. 中间区块:严格工作流程。该区块通过一条带有节点的垂直轴线,串联起三个工作步骤,每个步骤放置在圆角标签中:步骤一:分析需求(图标为粉色的大脑与一个带有笑脸的彩色齿轮)。步骤二:收集信息(图标为一个拟人化的漏斗,正在过滤星星和圆点)。步骤三:生成图片(图标为带有猫爪印的调色板、画笔以及一个饼状图)。3. 右侧区块:重要规则与核心目标。该区块被设计成一个带有红白相间遮阳篷的备忘录面板。重要规则(包含四条规则,每条规则左侧配有图标):规则一:每次请求都是全新任务(图标为一个猫咪造型的甜甜圈)。规则二:优先使用辅助工具收集信息(图标为一个带有星星装饰的可爱手提包)。规则三:保留用户原始数据(图标为一个带有花朵旋钮的拟人化保险箱)。规则四:使用用户语言生成内容(图标为一块玉石质感的云纹装饰和一支铅笔)。核心目标(位于该区块底部,背景为淡紫色,右侧配有一个礼物盒图标):文本内容:“消除混乱,重构逻辑,实现高维维度视觉数据合成。”", "size": "2752x1536", "n": 1 }; fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(data) }) .then(res => { if (!res.ok) { throw new Error(`HTTP error! status: ${res.status}`); } return res.json(); }) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Install Hermes Agent Source: https://platform.sensenova.cn/docs Install the Hermes Agent using a bash script. After installation, reload your shell configuration. ```bash curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash ``` -------------------------------- ### Install OpenClaw with curl Source: https://platform.sensenova.cn/docs Install OpenClaw using a curl script for macOS, Linux, or WSL2 environments. ```bash curl -fsSL https://openclaw.ai/install.sh | bash ``` -------------------------------- ### Generate Infographic with SenseNova U1 Fast (Python) Source: https://platform.sensenova.cn/docs Example Python code to generate an infographic. This snippet demonstrates how to construct the request payload, including the model, prompt, size, and number of images. Ensure you have the 'requests' library installed and your API key is set. ```Python import requests import os api_key = os.environ.get("SENSENOVA_API_KEY") url = "https://token.sensenova.cn/v1/images/generations" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } data = { "model": "sensenova-u1-fast", "prompt": "这张信息图以柔和的粉色、淡黄色和浅蓝色为主色调,采用了极具亲和力的可爱卡通风格(包含猫咪、拟人化表情等元素)。整体排版从左到右分为三个主要区块,分别介绍核心能力、工作流程和重要规则。图表的左上角是醒目的主标题“信息图生成专家”,其下方紧跟副标题:“帮助用户将复杂信息转化为清晰易懂的视觉呈现”。以下是图表中各区块的详细结构和全部文字内容:1. 左侧区块:核心能力与专家提示。该区块主要列出了三项核心能力,并附带了一条专家提示。核心能力(由上至下排列,每项均配有可爱的拟人化图标):1. 联网搜索功能:查询最新网络信息(图标为一个带有猫耳、拿着放大镜的拟人化地球)。2. 网页内容读取功能:获取指定网页的详细内容(图标为一个戴着眼镜、正在阅读的拟人化纸卷)。3. 信息图生成功能:根据文字描述生成专业的信息图(图标为一个手持柱状图的可爱机器人)。专家提示(位于该区块底部,背景为黄色便利贴样式,右上角有一只探出纸箱的猫咪图标):文本内容:“熟练结合搜索与读取工具,最大化提升视觉数据的信息密度。”2. 中间区块:严格工作流程。该区块通过一条带有节点的垂直轴线,串联起三个工作步骤,每个步骤放置在圆角标签中:步骤一:分析需求(图标为粉色的大脑与一个带有笑脸的彩色齿轮)。步骤二:收集信息(图标为一个拟人化的漏斗,正在过滤星星和圆点)。步骤三:生成图片(图标为带有猫爪印的调色板、画笔以及一个饼状图)。3. 右侧区块:重要规则与核心目标。该区块被设计成一个带有红白相间遮阳篷的备忘录面板。重要规则(包含四条规则,每条规则左侧配有图标):规则一:每次请求都是全新任务(图标为一个猫咪造型的甜甜圈)。规则二:优先使用辅助工具收集信息(图标为一个带有星星装饰的可爱手提包)。规则三:保留用户原始数据(图标为一个带有花朵旋钮的拟人化保险箱)。规则四:使用用户语言生成内容(图标为一块玉石质感的云纹装饰和一支铅笔)。核心目标(位于该区块底部,背景为淡紫色,右侧配有一个礼物盒图标):文本内容:“消除混乱,重构逻辑,实现高维维度视觉数据合成。”", "size": "2752x1536", "n": 1 } response = requests.post(url, headers=headers, json=data) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### SenseNova 6.7 Flash-Lite Image Input (Multimodal) Example Source: https://platform.sensenova.cn/docs Demonstrates how to use the SenseNova 6.7 Flash-Lite model for multimodal understanding by including an image URL in the message content. The 'content' can be an array of text and image blocks. ```shell curl https://token.sensenova.cn/v1/chat/completions \ -H "Authorization: Bearer $SENSENOVA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "sensenova-6.7-flash-lite", "messages": [ { "content": "你是一个说话客观公正的小助手", "role": "system" }, { "role": "user", "content": [ { "type": "text", "text": "图片里面有什么" }, { "type": "image_url", "image_url": { "url": "https://example.com/sample-image.jpg" } } ] } ], "n": 1, "stream": false, "max_tokens": 1000, "reasoning_effort": "none" }' ``` -------------------------------- ### Tool Calling Request Example Source: https://platform.sensenova.cn/docs Example of a request to enable function calling. Declare available functions in the 'tools' field. The model will return 'tool_calls' when it needs to use a tool. ```json { "model": "sensenova-6.7-flash-lite", "messages": [{ "role": "user", "content": "今天上海天气怎么样?" }], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get current weather of a city", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` -------------------------------- ### List Available Models Source: https://platform.sensenova.cn/docs Use this GET request to retrieve a list of all available models and their basic information. Ensure your request includes the correct Authorization header. ```http GET https://token.sensenova.cn/v1/models ``` ```http Authorization: Bearer $SENSENOVA_API_KEY ``` ```curl curl https://token.sensenova.cn/v1/models \ -H "Authorization: Bearer $SENSENOVA_API_KEY" ``` -------------------------------- ### SenseNova 6.7 Flash-Lite Text Chat Example Source: https://platform.sensenova.cn/docs Example of a pure text-based conversation with the SenseNova 6.7 Flash-Lite model. Set 'stream' to false for non-streaming responses. ```shell curl https://token.sensenova.cn/v1/chat/completions \ -H "Authorization: Bearer $SENSENOVA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "sensenova-6.7-flash-lite", "messages": [ { "role": "system", "content": "你是一个有用的助手。" }, { "role": "user", "content": "介绍一下商汤科技。" } ], "stream": false }' ``` -------------------------------- ### Install Claude Code on macOS/Linux/WSL2 Source: https://platform.sensenova.cn/docs Use this command to install Claude Code on macOS, Linux, or WSL2 environments. ```bash curl -fsSL https://claude.ai/install.sh | bash ``` -------------------------------- ### Model Response with Tool Calls Source: https://platform.sensenova.cn/docs Example of how the model responds when it needs to call a tool. The response includes 'tool_calls' with details about the function to be invoked. ```json { "choices": [ { "message": { "role": "assistant", "content": null, "tool_calls": [ { "index": 0, "id": "call_abc123", "type": "function", "function": { "name": "get_weather", "arguments": "{\"city\": \"上海\"}" } } ] }, "finish_reason": "tool_calls" } ] } ``` -------------------------------- ### Install Claude Code on Windows PowerShell Source: https://platform.sensenova.cn/docs Execute this command in Windows PowerShell to install Claude Code. ```powershell irm https://claude.ai/install.ps1 | iex ``` -------------------------------- ### Generate Infographic with SenseNova U1 Fast (cURL) Source: https://platform.sensenova.cn/docs Example cURL command to generate an infographic. Ensure you replace $SENSENOVA_API_KEY with your actual API key. The prompt specifies the desired style, color palette, layout, and content for the infographic. ```cURL curl https://token.sensenova.cn/v1/images/generations \ -H "Authorization: Bearer $SENSENOVA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "sensenova-u1-fast", "prompt": "这张信息图以柔和的粉色、淡黄色和浅蓝色为主色调,采用了极具亲和力的可爱卡通风格(包含猫咪、拟人化表情等元素)。整体排版从左到右分为三个主要区块,分别介绍核心能力、工作流程和重要规则。图表的左上角是醒目的主标题“信息图生成专家”,其下方紧跟副标题:“帮助用户将复杂信息转化为清晰易懂的视觉呈现”。以下是图表中各区块的详细结构和全部文字内容:1. 左侧区块:核心能力与专家提示。该区块主要列出了三项核心能力,并附带了一条专家提示。核心能力(由上至下排列,每项均配有可爱的拟人化图标):1. 联网搜索功能:查询最新网络信息(图标为一个带有猫耳、拿着放大镜的拟人化地球)。2. 网页内容读取功能:获取指定网页的详细内容(图标为一个戴着眼镜、正在阅读的拟人化纸卷)。3. 信息图生成功能:根据文字描述生成专业的信息图(图标为一个手持柱状图的可爱机器人)。专家提示(位于该区块底部,背景为黄色便利贴样式,右上角有一只探出纸箱的猫咪图标):文本内容:“熟练结合搜索与读取工具,最大化提升视觉数据的信息密度。”2. 中间区块:严格工作流程。该区块通过一条带有节点的垂直轴线,串联起三个工作步骤,每个步骤放置在圆角标签中:步骤一:分析需求(图标为粉色的大脑与一个带有笑脸的彩色齿轮)。步骤二:收集信息(图标为一个拟人化的漏斗,正在过滤星星和圆点)。步骤三:生成图片(图标为带有猫爪印的调色板、画笔以及一个饼状图)。3. 右侧区块:重要规则与核心目标。该区块被设计成一个带有红白相间遮阳篷的备忘录面板。重要规则(包含四条规则,每条规则左侧配有图标):规则一:每次请求都是全新任务(图标为一个猫咪造型的甜甜圈)。规则二:优先使用辅助工具收集信息(图标为一个带有星星装饰的可爱手提包)。规则三:保留用户原始数据(图标为一个带有花朵旋钮的拟人化保险箱)。规则四:使用用户语言生成内容(图标为一块玉石质感的云纹装饰和一支铅笔)。核心目标(位于该区块底部,背景为淡紫色,右侧配有一个礼物盒图标):文本内容:“消除混乱,重构逻辑,实现高维维度视觉数据合成。”", "size": "2752x1536", "n": 1 }' ``` -------------------------------- ### Streaming Response (SSE) Example Source: https://platform.sensenova.cn/docs When `stream: true` is set, the response Content-Type is `text/event-stream`. Each line pushes a chunk as `data: {json}`, ending with `data: [DONE]`. The `usage` field is returned in the last chunk only if `stream_options.include_usage` is true. ```text data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1713167890,"model":"sensenova-6.7-flash-lite","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"! How can I help?"},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":12,"completion_tokens":8,"total_tokens":20}]} data: [DONE] ``` -------------------------------- ### Run OpenClaw Onboarding Source: https://platform.sensenova.cn/docs Manually trigger the OpenClaw onboarding wizard to configure custom providers, API base URL, API key, and model ID. ```bash openclaw onboard --install-daemon ``` -------------------------------- ### Configure Hermes Agent Model Interactively Source: https://platform.sensenova.cn/docs Run the model-specific configuration for Hermes Agent, selecting a custom OpenAI-compatible provider and entering SenseNova details. ```bash hermes model ``` -------------------------------- ### Configure OpenCode with SenseNova Source: https://platform.sensenova.cn/docs Configure OpenCode to use SenseNova as the AI provider by creating an opencode.json file. Replace $SENSENOVA_API_KEY with your actual API key and ensure the baseURL ends with /v1. ```json { "$schema": "https://opencode.ai/config.json", "provider": { "sense-nova": { "npm": "@ai-sdk/openai-compatible", "name": "Sense Nova", "options": { "baseURL": "https://token.sensenova.cn/v1", "apiKey": "$SENSENOVA_API_KEY" }, "models": { "sensenova-6.7-flash-lite": { "name": "SenseNova 6.7 Flash-Lite", "modalities": { "input": ["text", "image"], "output": ["text"] }, "limit": { "context": 256000, "output": 65536 } } } } } } ``` -------------------------------- ### Continue: Local Config YAML for SenseNova Model Source: https://platform.sensenova.cn/docs Configure the Continue extension in VS Code or JetBrains IDEs to use a SenseNova model. Replace '$SENSENOVA_API_KEY' with your actual API key. ```yaml models: - name: SenseNova 6.7 Flash-Lite provider: openai model: sensenova-6.7-flash-lite apiBase: https://token.sensenova.cn/v1 apiKey: $SENSENOVA_API_KEY # 替换为您的 API Key ``` -------------------------------- ### Configure Hermes Agent via Command Line Source: https://platform.sensenova.cn/docs Configure Hermes Agent to use a custom provider (SenseNova) with the specified base URL, API key, and model name. Ensure 'model.default' is set. ```bash hermes config set model.provider custom hermes config set model.base_url https://token.sensenova.cn/v1 hermes config set model.api_key "$SENSENOVA_API_KEY" # 替换为您的 API Key hermes config set model.name sensenova-6.7-flash-lite hermes config set model.default custom/sensenova-6.7-flash-lite ``` -------------------------------- ### Run Claude Code Source: https://platform.sensenova.cn/docs Navigate to your project directory and run the `claude` command to activate Claude Code's AI programming assistance. ```bash claude ``` -------------------------------- ### Skip Anthropic Onboarding Check Source: https://platform.sensenova.cn/docs Create a configuration file to bypass the initial Anthropic service connectivity check when using third-party APIs. ```bash echo '{"hasCompletedOnboarding": true}' > ~/.claude.json ``` -------------------------------- ### List Available Models Source: https://platform.sensenova.cn/docs Fetches a list of all available models, providing essential details for each. ```APIDOC ## GET /v1/models ### Description Lists the currently available models, returning basic information for each model, including capabilities, context length, and pricing. ### Method GET ### Endpoint https://token.sensenova.cn/v1/models ### Authentication Requires an API key. `Authorization: Bearer $SENSENOVA_API_KEY` ### Request Example ```bash curl https://token.sensenova.cn/v1/models \ -H "Authorization: Bearer $SENSENOVA_API_KEY" ``` ### Response #### Success Response (200) Returns a JSON object containing a `data` array, where each element is a Model object. **Model Object Fields:** - `id` (string): Unique identifier for the model, used when calling the API. - `name` (string): Model name (usually consistent with `id`). - `created` (number): Model creation/release timestamp (Unix timestamp, seconds). - `description` (string): Textual description of the model's capabilities. - `input_modalities` (array of string): Supported input modalities (e.g., `text`, `image`). - `output_modalities` (array of string): Supported output modalities (e.g., `text`, `image`). - `context_length` (number): Maximum context window length (in tokens). - `max_output_length` (number): Maximum output length per request (in tokens). - `quantization` (string): Model quantization precision (e.g., `fp8`). - `pricing` (object): Pricing information. - `supported_sampling_parameters` (array of string): List of sampling parameters supported by the model. - `supported_features` (array of string): List of features supported by the model. - `hugging_face_id` (string): Corresponding HuggingFace model ID, if available. - `openrouter` (object): OpenRouter routing information, including the `slug` field. - `datacenters` (array of object): List of datacenters where the model is deployed, including `country_code`. ### Response Example ```json { "data": [ { "id": "sensenova-6.7-flash-lite", "hugging_face_id": "", "name": "sensenova-6.7-flash-lite", "created": 1777392000, "input_modalities": ["text", "image"], "output_modalities": ["text"], "quantization": "fp8", "context_length": 262144, "max_output_length": 65536, "pricing": { "prompt": "0", "completion": "0", "image": "0", "request": "0", "input_cache_read": "0" }, "supported_sampling_parameters": ["temperature", "stop"], "supported_features": ["tools", "json_mode", "reasoning"], "description": "SenseNova 6.7 Flash-Lite is a lightweight multimodal agent model...", "openrouter": { "slug": "sensenova/sensenova-6.7-flash-lite" }, "datacenters": [{ "country_code": "CN" }] } ] } ``` ``` -------------------------------- ### Implement Tool Calling Source: https://platform.sensenova.cn/docs Integrate external tools by defining them in the 'tools' array. The model can then choose to call these tools based on the user's request and the 'tool_choice' parameter. ```json { "model": "deepseek-v4-flash", "messages": [{"role": "user", "content": "杭州今天天气怎么样?" }], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "获取指定城市的当前天气", "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] } } } ], "tool_choice": "auto" } ``` -------------------------------- ### Configure Claude Code Settings for SenseNova Source: https://platform.sensenova.cn/docs Edit the `~/.claude/settings.json` file to configure environment variables for SenseNova's Anthropic-compatible endpoint. Replace `$SENSENOVA_API_KEY` with your actual SenseNova API Key. Ensure `ANTHROPIC_BASE_URL` does not include a `/v1` suffix. ```json { "env": { "ANTHROPIC_AUTH_TOKEN": "$SENSENOVA_API_KEY", "ANTHROPIC_BASE_URL": "https://token.sensenova.cn", "ANTHROPIC_MODEL": "sensenova-6.7-flash-lite", "ANTHROPIC_DEFAULT_SONNET_MODEL": "sensenova-6.7-flash-lite", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "sensenova-6.7-flash-lite", "ANTHROPIC_DEFAULT_OPUS_MODEL": "sensenova-6.7-flash-lite" } } ``` -------------------------------- ### Chat Completions Source: https://platform.sensenova.cn/docs This endpoint allows for chat-based interactions with SenseNova models. It supports plain text conversations, multimodal understanding with image inputs, and function calling for integrating external tools. ```APIDOC ## POST /v1/chat/completions ### Description Handles chat-based interactions, including text-only conversations, multimodal understanding with image inputs, and function calling. ### Method POST ### Endpoint https://token.sensenova.cn/v1/chat/completions ### Parameters #### Request Body - **model** (string) - Required - The model ID to use for the chat completion. - **messages** (array) - Required - An array of message objects representing the conversation history. - **role** (string) - Required - The role of the message sender (e.g., "system", "user", "assistant", "tool"). - **content** (string or array) - Required - The content of the message. Can be a string for text or an array of content blocks for multimodal input. - **type** (string) - Required - The type of content block (e.g., "text", "image_url"). - **text** (string) - Optional - The text content. - **image_url** (object) - Optional - An object containing the URL of the image. - **url** (string) - Required - The URL of the image. - **n** (integer) - Optional - How many chat completion choices to generate for each input message. - **stream** (boolean) - Optional - Whether to stream back partial message deltas as they are generated. - **max_tokens** (integer) - Optional - The maximum number of tokens to generate in the completion. - **reasoning_effort** (string) - Optional - Controls the reasoning effort for the model (e.g., "none"). - **tools** (array) - Optional - A list of tools the model may call. - **type** (string) - Required - The type of tool (e.g., "function"). - **function** (object) - Required - The function definition. - **name** (string) - Required - The name of the function. - **description** (string) - Optional - A description of the function. - **parameters** (object) - Required - The parameters the function accepts. - **type** (string) - Required - The type of the parameters object (e.g., "object"). - **properties** (object) - Optional - Definitions of the parameters. - **required** (array) - Optional - The names of the parameters that are required. - **tool_choice** (string or object) - Optional - Controls how the model selects a tool to call (e.g., "auto"). ### Request Example ```json { "model": "sensenova-6.7-flash-lite", "messages": [ { "content": "你是一个说话客观公正的小助手", "role": "system" }, { "role": "user", "content": [ { "type": "text", "text": "图片里面有什么" }, { "type": "image_url", "image_url": { "url": "https://example.com/sample-image.jpg" } } ] } ], "n": 1, "stream": false, "max_tokens": 1000, "reasoning_effort": "none" } ``` ### Response #### Success Response (200) - **choices** (array) - An array of chat completion choices. - **message** (object) - The generated message. - **role** (string) - The role of the message sender. - **content** (string or null) - The content of the message. Null if tool_calls are present. - **tool_calls** (array) - An array of tool calls if the model decided to call a tool. - **index** (integer) - The index of the tool call. - **id** (string) - The ID of the tool call. - **type** (string) - The type of the tool call (e.g., "function"). - **function** (object) - The function to call. - **name** (string) - The name of the function. - **arguments** (string) - The arguments to pass to the function, in JSON format. - **finish_reason** (string) - The reason the model stopped generating tokens (e.g., "stop", "length", "tool_calls"). #### Response Example ```json { "choices": [ { "message": { "role": "assistant", "content": null, "tool_calls": [ { "index": 0, "id": "call_abc123", "type": "function", "function": { "name": "get_weather", "arguments": "{\"city\": \"上海\"}" } } ] }, "finish_reason": "tool_calls" } ] } ``` ``` -------------------------------- ### Enable JSON Output Mode Source: https://platform.sensenova.cn/docs Force the model to respond in JSON format by setting 'response_format' to 'json_object'. Ensure the prompt also instructs the model to output JSON. ```json { "model": "deepseek-v4-flash", "messages": [ { "role": "system", "content": "请以 JSON 格式回答。" }, { "role": "user", "content": "列出三种编程语言及其特点。" } ], "response_format": { "type": "json_object" } } ``` -------------------------------- ### Verify Hermes Agent Source: https://platform.sensenova.cn/docs Launch the Hermes Agent interactive interface and send a message to verify that it responds in Chinese, indicating successful configuration. ```bash hermes ``` -------------------------------- ### Cursor: Add Custom Model Configuration Source: https://platform.sensenova.cn/docs Add a custom model in Cursor by specifying its name. This allows you to use SenseNova models within the Cursor IDE. ```bash sensenova-6.7-flash-lite ``` -------------------------------- ### Cursor: Override OpenAI Base URL Configuration Source: https://platform.sensenova.cn/docs Configure Cursor to use a custom OpenAI Base URL for connecting to SenseNova's API. Ensure you have a Cursor Pro subscription or higher. ```bash https://token.sensenova.cn/v1 ``` -------------------------------- ### Generate Infographic Source: https://platform.sensenova.cn/docs Generates an infographic based on a text prompt using the sensenova-u1-fast model. The generated image URL is temporary and expires after 1 hour. ```APIDOC ## POST /v1/images/generations ### Description Generates an infographic based on a text prompt using the sensenova-u1-fast model. The generated image URL is temporary and expires after 1 hour. ### Method POST ### Endpoint https://token.sensenova.cn/v1/images/generations ### Parameters #### Request Body - **model** (string) - Required - Fixed value: `sensenova-u1-fast` - **prompt** (string) - Required - Image description text, maximum 4096 tokens. - **size** (string) - Optional - Default: `"2752x1536"` - Image dimensions. Available options include: - `1664x2496` (2:3) - `2496x1664` (3:2) - `1760x2368` (3:4) - `2368x1760` (4:3) - `1824x2272` (4:5) - `2272x1824` (5:4) - `2048x2048` (1:1) - `2752x1536` (16:9) - `1536x2752` (9:16) - `3072x1376` (21:9) - `1344x3136` (9:21) - **n** (integer) - Optional - Default: `1` - Number of images to generate. ### Request Example ```json { "model": "sensenova-u1-fast", "prompt": "这张信息图以柔和的粉色、淡黄色和浅蓝色为主色调,采用了极具亲和力的可爱卡通风格(包含猫咪、拟人化表情等元素)。整体排版从左到右分为三个主要区块,分别介绍核心能力、工作流程和重要规则。图表的左上角是醒目的主标题“信息图生成专家”,其下方紧跟副标题:“帮助用户将复杂信息转化为清晰易懂的视觉呈现”。以下是图表中各区块的详细结构和全部文字内容:1. 左侧区块:核心能力与专家提示。该区块主要列出了三项核心能力,并附带了一条专家提示。核心能力(由上至下排列,每项均配有可爱的拟人化图标):1. 联网搜索功能:查询最新网络信息(图标为一个带有猫耳、拿着放大镜的拟人化地球)。2. 网页内容读取功能:获取指定网页的详细内容(图标为一个戴着眼镜、正在阅读的拟人化纸卷)。3. 信息图生成功能:根据文字描述生成专业的信息图(图标为一个手持柱状图的可爱机器人)。专家提示(位于该区块底部,背景为黄色便利贴样式,右上角有一只探出纸箱的猫咪图标):文本内容:“熟练结合搜索与读取工具,最大化提升视觉数据的信息密度。”2. 中间区块:严格工作流程。该区块通过一条带有节点的垂直轴线,串联起三个工作步骤,每个步骤放置在圆角标签中:步骤一:分析需求(图标为粉色的大脑与一个带有笑脸的彩色齿轮)。步骤二:收集信息(图标为一个拟人化的漏斗,正在过滤星星和圆点)。步骤三:生成图片(图标为带有猫爪印的调色板、画笔以及一个饼状图)。3. 右侧区块:重要规则与核心目标。该区块被设计成一个带有红白相间遮阳篷的备忘录面板。重要规则(包含四条规则,每条规则左侧配有图标):规则一:每次请求都是全新任务(图标为一个猫咪造型的甜甜圈)。规则二:优先使用辅助工具收集信息(图标为一个带有星星装饰的可爱手提包)。规则三:保留用户原始数据(图标为一个带有花朵旋钮的拟人化保险箱)。规则四:使用用户语言生成内容(图标为一块玉石质感的云纹装饰和一支铅笔)。核心目标(位于该区块底部,背景为淡紫色,右侧配有一个礼物盒图标):文本内容:“消除混乱,重构逻辑,实现高维维度视觉数据合成。”", "size": "2752x1536", "n": 1 } ``` ### Response #### Success Response (200) - **created** (integer) - Timestamp of creation. - **data** (array) - Array of generated image objects. - **url** (string) - URL of the generated image (expires in 1 hour). #### Response Example ```json { "created": 1713167890, "data": [ { "url": "https://cdn.sensenova.dev/gen/..." } ] } ``` ``` -------------------------------- ### Verify OpenClaw Agent Source: https://platform.sensenova.cn/docs Test the OpenClaw agent configuration by sending a message and checking for a Chinese response. ```bash openclaw agent --message "你好,自我介绍一下" --agent main ```