Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
763e8dce
authored
Sep 16, 2026
by
renyizhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
models-with-pricing接口新增字段
parent
4f0c132c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
0 deletions
+83
-0
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/controller/app/aimodel/AppAiModelController.java
+55
-0
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/controller/app/aimodel/vo/AppModelPricingVO.java
+28
-0
No files found.
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/controller/app/aimodel/AppAiModelController.java
View file @
763e8dce
...
...
@@ -171,6 +171,10 @@ public class AppAiModelController {
@SuppressWarnings
(
"unchecked"
)
List
<
Map
<
String
,
Object
>>
vendors
=
(
List
<
Map
<
String
,
Object
>>)
pricingData
.
get
(
"vendors"
);
// 3.5 提取顶级 supported_endpoint(端点 → URL 路径映射)
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Map
<
String
,
Object
>>
topEndpoints
=
(
Map
<
String
,
Map
<
String
,
Object
>>)
pricingData
.
get
(
"supported_endpoint"
);
// 4. 拉取所有模型元数据(分页循环,因 New API page_size 上限为 100)
NewApiResponse
<
List
<
Map
<
String
,
Object
>>>
modelsResp
=
newApiClient
.
getAllModels
();
if
(
modelsResp
.
getSuccess
()
==
null
||
!
modelsResp
.
getSuccess
()
||
modelsResp
.
getData
()
==
null
)
{
...
...
@@ -285,6 +289,57 @@ public class AppAiModelController {
// vendor 名称匹配(不主动推断 icon,New API 没配就保持 null)
vo
.
setVendorName
(
resolveVendorName
(
modelName
,
vendors
));
// endpoints:每个模型都带上顶级 supported_endpoint,前端按需取
if
(
topEndpoints
!=
null
)
{
vo
.
setEndpoints
(
topEndpoints
);
}
// 解析使用方式相关字段(来自 pricing.txt)
if
(
pricing
!=
null
)
{
// api_examples:使用示例数组(每个含 endpoint/profile/providers/groups)
Object
apiExamplesObj
=
pricing
.
get
(
"api_examples"
);
if
(
apiExamplesObj
instanceof
List
)
{
@SuppressWarnings
(
"unchecked"
)
List
<
Map
<
String
,
Object
>>
apiExamplesRaw
=
(
List
<
Map
<
String
,
Object
>>)
apiExamplesObj
;
List
<
AppModelPricingVO
.
ApiExampleVO
>
apiExamples
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
ae
:
apiExamplesRaw
)
{
AppModelPricingVO
.
ApiExampleVO
aeVo
=
new
AppModelPricingVO
.
ApiExampleVO
();
aeVo
.
setEndpoint
((
String
)
ae
.
get
(
"endpoint"
));
aeVo
.
setProfile
((
String
)
ae
.
get
(
"profile"
));
Object
providers
=
ae
.
get
(
"providers"
);
if
(
providers
instanceof
List
)
{
@SuppressWarnings
(
"unchecked"
)
List
<
String
>
ps
=
(
List
<
String
>)
providers
;
aeVo
.
setProviders
(
ps
);
}
Object
groups
=
ae
.
get
(
"groups"
);
if
(
groups
instanceof
List
)
{
@SuppressWarnings
(
"unchecked"
)
List
<
String
>
gs
=
(
List
<
String
>)
groups
;
aeVo
.
setGroups
(
gs
);
}
apiExamples
.
add
(
aeVo
);
}
vo
.
setApiExamples
(
apiExamples
);
}
// billing_usage_schema:参数定义
Object
schemaObj
=
pricing
.
get
(
"billing_usage_schema"
);
if
(
schemaObj
instanceof
Map
)
{
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
Object
>
schemaMap
=
(
Map
<
String
,
Object
>)
schemaObj
;
vo
.
setBillingUsageSchema
(
schemaMap
);
}
// billing_usage_examples:示例数据
Object
examplesObj
=
pricing
.
get
(
"billing_usage_examples"
);
if
(
examplesObj
instanceof
List
)
{
@SuppressWarnings
(
"unchecked"
)
List
<
Map
<
String
,
Object
>>
examples
=
(
List
<
Map
<
String
,
Object
>>)
examplesObj
;
vo
.
setBillingUsageExamples
(
examples
);
}
}
result
.
add
(
vo
);
}
...
...
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/controller/app/aimodel/vo/AppModelPricingVO.java
View file @
763e8dce
...
...
@@ -94,6 +94,34 @@ public class AppModelPricingVO {
@Schema
(
description
=
"条件乘数列表"
)
private
List
<
ConditionMultiplierVO
>
conditionMultipliers
;
@Schema
(
description
=
"API 使用示例(含 endpoint、profile、providers、groups)"
)
private
List
<
ApiExampleVO
>
apiExamples
;
@Schema
(
description
=
"端点 → URL 路径映射(来自 pricing.supported_endpoint,每个模型都带,便于前端按需取)"
)
private
Map
<
String
,
Map
<
String
,
Object
>>
endpoints
;
@Schema
(
description
=
"计费用法 schema(仅 openai-video 等模型有)"
)
private
Map
<
String
,
Object
>
billingUsageSchema
;
@Schema
(
description
=
"计费用法示例"
)
private
List
<
Map
<
String
,
Object
>>
billingUsageExamples
;
/**
* API 使用示例(来自 pricing.txt 的 api_examples 数组)
*/
@Data
@Schema
(
description
=
"API 使用示例"
)
public
static
class
ApiExampleVO
{
@Schema
(
description
=
"端点类型,如 openai、openai-video、embeddings"
)
private
String
endpoint
;
@Schema
(
description
=
"调用配置,如 standard、seedance2、ctyun-seedream"
)
private
String
profile
;
@Schema
(
description
=
"服务商列表"
)
private
List
<
String
>
providers
;
@Schema
(
description
=
"适用分组列表"
)
private
List
<
String
>
groups
;
}
/**
* 分档信息 VO
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment