Files
haiyushuke-website/content/getting-started.mdx
2026-07-02 12:58:18 +08:00

89 lines
2.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 快速开始
description: 注册、环境配置、API Key 与首次调用
---
# 快速开始
本指南对应开放平台常见的「分钟级接入」流程(参见 [智谱 · 快速开始](https://docs.bigmodel.cn/cn/guide/start/introduction) 类文档结构),步骤以 **海宇数科控制台与网关** 为准。
## 1. 注册并登录控制台
访问 [控制台](https://console.haiyushuke.com),使用手机号注册并登录。
## 2. 完成实名认证
创建 **API Key**、使用 **体验中心**、**账户充值** 与查看完整 **财务** 信息前,需完成实名认证:
1. 侧栏 **账户中心 → 实名认证**
2. 按页面指引提交个人或企业认证材料
3. 认证通过后,上述功能即可正常使用
企业用户若需 **对公转账充值**,须完成 **企业认证**。
## 3. 配置开发环境(可选)
在集成代码的机器上设置环境变量,避免硬编码 Key
```bash
export HAIYUSHUKE_API_KEY="你的密钥"
export HAIYUSHUKE_BASE_URL="https://api.haiyushuke.com/v1"
```
SDK 安装:
```bash
# Node.js
npm install openai
# Python
pip install openai
```
详见 [OpenAI SDK 兼容](/docs/guides/openai_compatible)。
## 4. 为账户充值(可选)
预付费环境下,请进入 **财务 → 账户充值** 完成充值后再调用 API。
## 5. 创建 API Key
1. 侧栏 **API Key** → **创建**
2. 填写名称(如 `dev-backend`
3. 可选可用模型、额度、过期时间、IP 白名单
4. **立即复制并保存** 完整密钥(仅展示一次)
## 6. 选择模型 ID
在控制台 **模型广场** 确认 `model` ID也可在 **体验中心** 试调用后再写入代码。IDE 配置见 [工具接入概览](/docs/integrations/overview)。
## 7. 发起测试请求
**HTTPcurl**
```bash
curl https://api.haiyushuke.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [{"role": "user", "content": "你好,请用一句话介绍海宇数科"}]
}'
```
成功时 JSON 含 `choices[0].message.content` 与 `usage`。接口细节见 [HTTP API](/docs/guides/http_api)。
## 8. 核对用量
在 **财务 → 使用记录** 查看 token 与费用;理解 **Token** 含义见 [核心概念](/docs/concepts/overview)。
## 下一步
| 目标 | 文档 |
| --- | --- |
| 用 SDK 接入 | [OpenAI SDK 兼容](/docs/guides/openai_compatible) |
| 流式 UI | [流式调用](/docs/guides/streaming) |
| 配置 IDE | [Cursor](/docs/integrations/cursor)、[Claude Code](/docs/integrations/claude_code) 等 |
| 运维与计费 | [API Key](/docs/guides/api_keys)、[计费与财务](/docs/guides/billing) |
| 排错 | [常见问题](/docs/faq) |