Skip to content

Latest commit

Β 

History

History
697 lines (488 loc) Β· 19.6 KB

File metadata and controls

697 lines (488 loc) Β· 19.6 KB

DatabaseApi

All URIs are relative to http://localhost

Method HTTP request Description
cacheModelApiDbCachePost POST /api/db/cache Cache Model
getFileApiDbFilesFileIdGet GET /api/db/files/{file_id} Get File
getModelApiDbModelsCivitaiIdGet GET /api/db/models/{civitai_id} Get Model
getStatsApiDbStatsGet GET /api/db/stats Get Stats
getTriggersByPathApiDbTriggersGet GET /api/db/triggers Get Triggers By Path
getTriggersByVersionApiDbTriggersVersionIdGet GET /api/db/triggers/{version_id} Get Triggers By Version
linkFilesApiDbLinkPost POST /api/db/link Link Files
listFilesApiDbFilesGet GET /api/db/files List Files
scanDirectoryApiDbScanPost POST /api/db/scan Scan Directory
searchModelsApiDbModelsGet GET /api/db/models Search Models

cacheModelApiDbCachePost

{ [key: string]: any; } cacheModelApiDbCachePost(cacheRequest)

Cache Model

Fetch and cache full CivitAI model data.

Example

import {
  Configuration,
  DatabaseApi,
} from '@saiden/tensors';
import type { CacheModelApiDbCachePostRequest } from '@saiden/tensors';

async function example() {
  console.log("πŸš€ Testing @saiden/tensors SDK...");
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: "YOUR API KEY",
    // To configure API key authorization: APIKeyQuery
    apiKey: "YOUR API KEY",
  });
  const api = new DatabaseApi(config);

  const body = {
    // CacheRequest
    cacheRequest: ...,
  } satisfies CacheModelApiDbCachePostRequest;

  try {
    const data = await api.cacheModelApiDbCachePost(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);

Parameters

Name Type Description Notes
cacheRequest CacheRequest

Return type

{ [key: string]: any; }

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getFileApiDbFilesFileIdGet

{ [key: string]: any; } getFileApiDbFilesFileIdGet(fileId)

Get File

Get local file by ID.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { GetFileApiDbFilesFileIdGetRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  const body = {
    // number
    fileId: 56,
  } satisfies GetFileApiDbFilesFileIdGetRequest

  try {
    const data = await api.getFileApiDbFilesFileIdGet(body)
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

Name Type Description Notes
fileId number [Defaults to undefined]

Return type

{ [key: string]: any; }

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getModelApiDbModelsCivitaiIdGet

{ [key: string]: any; } getModelApiDbModelsCivitaiIdGet(civitaiId)

Get Model

Get cached model by CivitAI ID.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { GetModelApiDbModelsCivitaiIdGetRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  const body = {
    // number
    civitaiId: 56,
  } satisfies GetModelApiDbModelsCivitaiIdGetRequest

  try {
    const data = await api.getModelApiDbModelsCivitaiIdGet(body)
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

Name Type Description Notes
civitaiId number [Defaults to undefined]

Return type

{ [key: string]: any; }

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getStatsApiDbStatsGet

{ [key: string]: any; } getStatsApiDbStatsGet()

Get Stats

Get database statistics.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { GetStatsApiDbStatsGetRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  try {
    const data = await api.getStatsApiDbStatsGet()
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

This endpoint does not need any parameter.

Return type

{ [key: string]: any; }

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getTriggersByPathApiDbTriggersGet

Array<string | null> getTriggersByPathApiDbTriggersGet(filePath)

Get Triggers By Path

Get trigger words for a local file by path.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { GetTriggersByPathApiDbTriggersGetRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  const body = {
    // string | Path to safetensor file
    filePath: filePath_example,
  } satisfies GetTriggersByPathApiDbTriggersGetRequest

  try {
    const data = await api.getTriggersByPathApiDbTriggersGet(body)
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

Name Type Description Notes
filePath string Path to safetensor file [Defaults to undefined]

Return type

Array<string | null>

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getTriggersByVersionApiDbTriggersVersionIdGet

Array<string | null> getTriggersByVersionApiDbTriggersVersionIdGet(versionId)

Get Triggers By Version

Get trigger words for a version by CivitAI version ID.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { GetTriggersByVersionApiDbTriggersVersionIdGetRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  const body = {
    // number
    versionId: 56,
  } satisfies GetTriggersByVersionApiDbTriggersVersionIdGetRequest

  try {
    const data = await api.getTriggersByVersionApiDbTriggersVersionIdGet(body)
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

Name Type Description Notes
versionId number [Defaults to undefined]

Return type

Array<string | null>

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

linkFilesApiDbLinkPost

{ [key: string]: any; } linkFilesApiDbLinkPost()

Link Files

Link unlinked local files to CivitAI by hash lookup.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { LinkFilesApiDbLinkPostRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  try {
    const data = await api.linkFilesApiDbLinkPost()
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

This endpoint does not need any parameter.

Return type

{ [key: string]: any; }

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listFilesApiDbFilesGet

Array<{ [key: string]: any; }> listFilesApiDbFilesGet()

List Files

List all local files with CivitAI info.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { ListFilesApiDbFilesGetRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  try {
    const data = await api.listFilesApiDbFilesGet()
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

This endpoint does not need any parameter.

Return type

Array<{ [key: string]: any; }>

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

scanDirectoryApiDbScanPost

{ [key: string]: any; } scanDirectoryApiDbScanPost(scanRequest)

Scan Directory

Scan directory for safetensor files and add to database.

Example

import {
  Configuration,
  DatabaseApi,
} from '@saiden/tensors';
import type { ScanDirectoryApiDbScanPostRequest } from '@saiden/tensors';

async function example() {
  console.log("πŸš€ Testing @saiden/tensors SDK...");
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: "YOUR API KEY",
    // To configure API key authorization: APIKeyQuery
    apiKey: "YOUR API KEY",
  });
  const api = new DatabaseApi(config);

  const body = {
    // ScanRequest
    scanRequest: ...,
  } satisfies ScanDirectoryApiDbScanPostRequest;

  try {
    const data = await api.scanDirectoryApiDbScanPost(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);

Parameters

Name Type Description Notes
scanRequest ScanRequest

Return type

{ [key: string]: any; }

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

searchModelsApiDbModelsGet

Array<{ [key: string]: any; }> searchModelsApiDbModelsGet(query, type, base, limit)

Search Models

Search cached models offline.

Example

import { Configuration, DatabaseApi } from '@saiden/tensors'
import type { SearchModelsApiDbModelsGetRequest } from '@saiden/tensors'

async function example() {
  console.log('πŸš€ Testing @saiden/tensors SDK...')
  const config = new Configuration({
    // To configure API key authorization: APIKeyHeader
    apiKey: 'YOUR API KEY',
    // To configure API key authorization: APIKeyQuery
    apiKey: 'YOUR API KEY',
  })
  const api = new DatabaseApi(config)

  const body = {
    // string | Search query (optional)
    query: query_example,
    // string | Model type filter (optional)
    type: type_example,
    // string | Base model filter (optional)
    base: base_example,
    // number | Max results (optional)
    limit: 56,
  } satisfies SearchModelsApiDbModelsGetRequest

  try {
    const data = await api.searchModelsApiDbModelsGet(body)
    console.log(data)
  } catch (error) {
    console.error(error)
  }
}

// Run the test
example().catch(console.error)

Parameters

Name Type Description Notes
query string Search query [Optional] [Defaults to undefined]
type string Model type filter [Optional] [Defaults to undefined]
base string Base model filter [Optional] [Defaults to undefined]
limit number Max results [Optional] [Defaults to 20]

Return type

Array<{ [key: string]: any; }>

Authorization

APIKeyHeader, APIKeyQuery

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]