AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

feat(integrations): add CometAPI support with models and credentials

Open tensornull opened this issue 1 month ago β€’ 10 comments

Changes πŸ—οΈ

Add CometAPI as a new LLM provider to AutoGPT Platform, following the existing OpenRouter integration pattern:

related issue: #10958

Checklist πŸ“‹

For code changes:

  • [x] I have clearly listed my changes in the PR description
  • [x] I have made a test plan
  • [x] I have tested my changes according to the test plan:
    • [x] Verified all 5 files modified correctly via Docker container inspection
    • [x] Confirmed 58 COMETAPI references present in backend code
    • [x] Validated Python imports: ProviderName.COMETAPI successfully loads
    • [x] Backend health check passes: {"status":"healthy"}
    • [x] All 27 models defined with correct metadata (context windows, max tokens)

For configuration changes:

  • [x] .env.default is updated or already compatible with my changes
  • [x] docker-compose.yml is updated or already compatible with my changes
  • [x] Configuration changes:
    • Added COMETAPI_KEY environment variable support

tensornull avatar Oct 09 '25 05:10 tensornull

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 09 '25 05:10 CLAassistant

This PR targets the master branch but does not come from dev or a hotfix/* branch.

Automatically setting the base branch to dev.

github-actions[bot] avatar Oct 09 '25 05:10 github-actions[bot]

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

[!NOTE]

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Oct 09 '25 05:10 coderabbitai[bot]

Deploy Preview for auto-gpt-docs canceled.

Name Link
Latest commit a8eea136a9579f3f9c6584275173c84408398457
Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/68e741841573c000082eea0c

netlify[bot] avatar Oct 09 '25 05:10 netlify[bot]

PR Reviewer Guide πŸ”

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 πŸ”΅πŸ”΅πŸ”΅βšͺβšͺ
πŸ§ͺΒ No relevant tests
πŸ”’Β No security concerns identified
⚑ Recommended focus areas for review

Possible Issue

In the OpenAI provider branch, the method now returns early, which skips the common LLMResponse construction below. Ensure this is intentional and that the return paths for OpenAI and CometAPI are consistent with other providers (e.g., usage handling, tool_calls parsing).

return LLMResponse(
    raw_response=response.choices[0].message,
    prompt=prompt,
    response=response.choices[0].message.content or "",
    tool_calls=tool_calls,
    prompt_tokens=response.usage.prompt_tokens if response.usage else 0,
    completion_tokens=response.usage.completion_tokens if response.usage else 0,
    reasoning=reasoning,
)
API Base URL

The CometAPI client uses a hardcoded base_url "https://api.cometapi.com/v1/". Confirm this is the correct endpoint and path for chat completions and that it matches the expected OpenAI-compatible route. Consider centralizing provider base URLs in config.

client = openai.AsyncOpenAI(
    base_url="https://api.cometapi.com/v1/",
    api_key=credentials.api_key.get_secret_value(),
)

response_format = None
if force_json_output:
    response_format = {"type": "json_object"}
Typo/Formatting

There appears to be an extra '+' before a list literal in the COMETAPI Models cost list, which may cause a syntax error or unintended list concatenation. Verify the list construction for BlockCost entries is syntactically correct.

+ [
    BlockCost(
        cost_type=BlockCostType.RUN,
        cost_filter={
            "model": model,
            "credentials": {
                "id": cometapi_credentials.id,
                "provider": cometapi_credentials.provider,
                "type": cometapi_credentials.type,
            },
        },
        cost_amount=cost,
    )
    for model, cost in MODEL_COST.items()
    if MODEL_METADATA[model].provider == "cometapi"
]
# AI/ML Api Models

qodo-merge-pro[bot] avatar Oct 09 '25 05:10 qodo-merge-pro[bot]

Here's the code health analysis summary for commits 59c27fe..ef3dae5. View details on DeepSourceΒ β†—.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScriptβœ…Β SuccessView CheckΒ β†—
DeepSource Python LogoPythonβœ…Β Success
❗ 2 occurences introduced
🎯 2 occurences resolved
View CheckΒ β†—

πŸ’‘ If you’re a repository administrator, you can configure the quality gates from the settings.

deepsource-io[bot] avatar Oct 09 '25 05:10 deepsource-io[bot]

Deploy Preview for auto-gpt-docs canceled.

Name Link
Latest commit ef3dae51dd8ab8ce307c0116906796968d3266a9
Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/68e746a4f3bff0000805e593

netlify[bot] avatar Oct 09 '25 05:10 netlify[bot]

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
Latest commit ef3dae51dd8ab8ce307c0116906796968d3266a9
Latest deploy log https://app.netlify.com/projects/auto-gpt-docs-dev/deploys/68e746a4dca876000799d22b

netlify[bot] avatar Oct 09 '25 05:10 netlify[bot]

Hey @Torantulino and @Bentlybro ,

Could you please help review this PR? If there’s anything that needs me to make changes, feel free to contact me anytime.

tensornull avatar Oct 09 '25 05:10 tensornull

Hey @TensorNull

Thank you so much for this PR, the implementation looks really solid. That said, we’re currently working on a new LLM picker UI that will make adding and managing providers like CometAPI much smoother. To keep things consistent and avoid merge conflicts later, we’re going to hold off on merging this PR for now.

Once the picker is in, this PR will be one of the first we merge in the next batch of provider updates. We really appreciate your patience and the effort you put into this.

I’ll be sure to post updates so you know when we plan to merge it!

Bentlybro avatar Oct 17 '25 08:10 Bentlybro