MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / create_sub2api_service

Function create_sub2api_service

src/database/crud.py:753–774  ·  view source on GitHub ↗

创建 Sub2API 服务配置

(
    db: Session,
    name: str,
    api_url: str,
    api_key: str,
    target_type: str = 'sub2api',
    enabled: bool = True,
    priority: int = 0
)

Source from the content-addressed store, hash-verified

751# ============================================================================
752
753def create_sub2api_service(
754 db: Session,
755 name: str,
756 api_url: str,
757 api_key: str,
758 target_type: str = 'sub2api',
759 enabled: bool = True,
760 priority: int = 0
761) -> Sub2ApiService:
762 """创建 Sub2API 服务配置"""
763 svc = Sub2ApiService(
764 name=name,
765 api_url=api_url,
766 api_key=api_key,
767 target_type=target_type,
768 enabled=enabled,
769 priority=priority,
770 )
771 db.add(svc)
772 db.commit()
773 db.refresh(svc)
774 return svc
775
776
777def get_sub2api_service_by_id(db: Session, service_id: int) -> Optional[Sub2ApiService]:

Callers

nothing calls this directly

Calls 1

Sub2ApiServiceClass · 0.85

Tested by

no test coverage detected