Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to CometAPI

Scalekit connector
Open markdown

The CometAPI connector lets your AI agent act in each user's CometAPI account. Each user connects their own CometAPI access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 37 tools.

Tools
37
What they doRead · write · destructive
15 · 22 · 015 read22 write0 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the CometAPI connection

    In AgentKit > Connections, create a CometAPI connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'cometapi'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize CometAPI:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'cometapi_api_key_usage_get',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their CometAPI credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • cometapi_api_key_usage_getGet the quota, usage, expiration and model limits of the connected CometAPI API key.Read-only

    Get API Key Usage

    Get the quota, usage, expiration and model limits of the connected CometAPI API key. Returns the key's name, total and used quota, remaining quota, expiry and allowed models. Use this to check the remaining balance before large jobs.

    Inputs

    This tool takes no inputs.

  • cometapi_flux_result_getGet the status and result of a FLUX image task.Read-only

    Get FLUX Result

    Get the status and result of a FLUX image task. Returns id, status and, when Ready, result.sample with the image URL. Use this after cometapi_flux_image_generate.

    Inputs

    idstringrequired
    Task ID returned by cometapi_flux_image_generate. Example: 6f2c1a7e-8b3d-4e5f-9a0b-1c2d3e4f5a6b.
  • cometapi_grok_video_getGet the status and result of a Grok video task.Read-only

    Get Grok Video Task

    Get the status and result of a Grok video task. Returns the status and, when done, the video URL and details. Use this after cometapi_grok_video_generate.

    Inputs

    request_idstringrequired
    Request ID returned by cometapi_grok_video_generate. Example: d2f1e3a4-5b6c-7d8e-9f01-23456789abcd.
  • cometapi_hunyuan3d_job_getGet the status and result files of a Hunyuan 3D job.Read-only

    Get Hunyuan 3D Job

    Get the status and result files of a Hunyuan 3D job. Returns the job status and, when done, the generated 3D files. Use this after cometapi_hunyuan3d_job_create.

    Inputs

    job_idstringrequired
    Job ID returned by cometapi_hunyuan3d_job_create. Example: 1234567890123456789.
  • cometapi_image_task_getGet the status and result of an asynchronous image generation task.Read-only

    Get Image Generation Task

    Get the status and result of an asynchronous image generation task. Returns the task status and, when finished, the image data. Use this after cometapi_image_generate with async true.

    Inputs

    task_idstringrequired
    Task ID from data.task_id of the async image request. Example: task_01JABCDEF.
  • cometapi_kling_task_getGet the status and result of a Kling image, video or audio task.Read-only

    Get Kling Task

    Get the status and result of a Kling image, video or audio task. Returns code and data with task_id, task_status and, when succeed, task_result with the video or image URLs. Use this after a Kling create tool, with the same resource and sub-action the task was created with.

    Inputs

    resourcestringrequired
    Resource type of the task: images, videos or audio. Example: videos.one of imagesvideosaudio
    sub_actionstringrequired
    Sub-action the task was created with, such as text2video or image2video for videos, or generations for images. Example: text2video.
    task_idstringrequired
    Kling task ID from data.task_id. Example: CjhVQGbpLk0AAAAAAAAAA.
  • cometapi_midjourney_task_getGet the status and result of one Midjourney task.Read-only

    Get Midjourney Task

    Get the status and result of one Midjourney task. Returns the task with status, progress, imageUrl, prompt and buttons (the customIds for follow-up actions). Use this to poll a task. Use cometapi_midjourney_tasks_list for several tasks at once.

    Inputs

    idstringrequired
    Midjourney task ID returned in result by a submit tool. Example: 1712345678901234.
  • cometapi_midjourney_tasks_listGet the status and results of several Midjourney tasks at once.Read-only

    List Midjourney Tasks by ID

    Get the status and results of several Midjourney tasks at once. Returns one task object per ID, with status, progress, imageUrl and buttons. Use this to poll many tasks. Use cometapi_midjourney_task_get for one task.

    Inputs

    idsarrayrequired
    Array of Midjourney task ids to retrieve. Returns the current status and result for each. Defaults to ["example"]. Example: ["1712345678901234", "1712345678905678"]