Last reviewed: 2026-08-10

Direct answer

A CometAPI Aider integration uses Aider’s OpenAI-compatible provider path. Set OPENAI_API_BASE to CometAPI’s documented /v1 base URL, load the CometAPI credential through OPENAI_API_KEY, and start Aider with a model name in the form openai/CURRENT_CHAT_MODEL_ID. The Aider OpenAI-compatible API guide documents those variables and the required openai/ model prefix. The CometAPI quick-start documentation establishes the matching /v1 base URL and OpenAI-compatible Chat Completions contract.

The important constraint is model capability. CometAPI’s catalog covers several model types, while this Aider connection expects a model that accepts the compatible chat request used by Aider. Do not select an image or video model merely because its ID appears in the catalog. Some coding or reasoning models may also require a different endpoint family. Confirm Chat Completions support before treating a model ID as usable here.

Happy-path workflow

  1. Install Aider using the commands documented by Aider:
python -m pip install aider-install
aider-install
cd /path/to/project
  1. Open the current CometAPI model-list guide . Choose a current model ID, then confirm that its capability matches Chat Completions. The guide distinguishes the public GET /api/models catalog from authenticated /v1/models; either can help with discovery, but the public catalog is the straightforward inventory source.

  2. At the Git repository root, create a local .env file. Replace both non-secret placeholders before launching Aider:

OPENAI_API_BASE=COMETAPI_OPENAI_BASE_URL
OPENAI_API_KEY=[REDACTED]
AIDER_MODEL=openai/CURRENT_CHAT_MODEL_ID
AIDER_TIMEOUT=60

COMETAPI_OPENAI_BASE_URL means the exact /v1 value in the linked CometAPI quick start. CURRENT_CHAT_MODEL_ID means the exact current catalog ID, without an invented alias. Keep the openai/ prefix in AIDER_MODEL; it tells Aider which compatible provider route to use.

  1. Exclude local configuration and optional conversation history from version control:
.env
.aider.llm.history

Aider’s .env configuration guide says it searches the home directory, Git root, current directory, and an explicitly selected environment file, with later-loaded files taking priority. Check for competing files if a value seems to be ignored. For a broader repository boundary, follow the same-site guide to keep CometAPI keys out of repositories .

  1. Start with an explanation-only request so the first connection test does not intentionally modify files:
aider --model openai/CURRENT_CHAT_MODEL_ID
Read the current files and explain the smallest safe change. Do not edit yet.

A successful first pass has four observable outcomes: Aider starts with the intended model, the request reaches the provider, a coherent response returns, and git status --short shows no new edit from the explanation-only prompt. Only then ask for a narrowly scoped change, inspect the diff, and run the repository’s focused test.

Who this is for

This setup is for developers who prefer terminal-based pair programming and already understand the basic risks of allowing an assistant to inspect or edit a working tree. It is especially useful when a team wants one OpenAI-compatible client workflow while choosing a current CometAPI model at runtime.

It is not a universal route for every model in the CometAPI catalog. Image, audio, and video models use different workflows. A coding or reasoning model that requires the Responses API is also outside this specific Chat Completions setup. Review the same-site model-selection notes for tutorial code samples before standardizing one model ID across a team.

Key takeaways

  • Aider expects OPENAI_API_BASE, OPENAI_API_KEY, and an openai/ model prefix for this compatible-provider route.
  • CometAPI documents a /v1 base URL for OpenAI-compatible calls.
  • Use a current catalog ID and verify Chat Completions support rather than inferring capability from the model name.
  • A local .env avoids placing a credential directly in a launch command, but the file must remain outside version control.
  • Start with a no-edit prompt, inspect repository state, and only then permit a focused change.
  • Record sanitized operational fields, never credential values, prompt bodies, response text, or source-file contents.

Sources checked

  • Aider: OpenAI compatible APIs documents installation, compatible endpoint variables, and the openai/<model-name> launch convention.
  • Aider: Config with .env documents environment-file discovery, load precedence, the model setting, timeout configuration, SSL verification, histories, and Git-related options.
  • CometAPI: Start with CometAPI documents the API-key workflow, the /v1 base URL, Chat Completions examples, and the need to select a current model ID.
  • CometAPI: List available models documents the public model catalog, the authenticated compatible model-list shape, and the risk of reusing stale IDs or choosing the wrong endpoint for a model type.

These sources support the connection contract and the checks in this article. They do not prove that every catalog model works with Aider, which is why the workflow verifies model capability and starts with a non-editing request.

Contract details to verify

Treat the integration as four separate contracts. A correct value in one layer does not compensate for a mismatch in another.

LayerVerifyExpected result
Aider provider routeModel argument begins with openai/Aider uses its OpenAI-compatible client path
Base URLOPENAI_API_BASE contains the documented CometAPI /v1 baseRequests target the compatible API family
Credential loadingOPENAI_API_KEY is present in the effective local environmentThe request is authenticated without exposing the value in the command
ModelSuffix after openai/ exactly matches a current catalog IDThe provider can resolve the requested model
CapabilitySelected model supports Chat CompletionsThe request shape matches the selected endpoint family
Repository stateThe first prompt explicitly requests no editConnection testing is separated from file mutation

The model string has two parts with different owners. openai/ is Aider’s routing prefix. CURRENT_CHAT_MODEL_ID is the provider’s catalog identifier. Do not add the prefix to the catalog lookup itself, and do not omit it from Aider’s model argument.

Environment precedence deserves a separate check. Aider loads multiple possible .env locations in order, and a later file wins. If the Git-root file looks correct but Aider reaches an old host or chooses an old model, inspect the current-directory file and any explicitly selected environment file. Do not print their complete contents to a shared log. Compare only the non-secret base host, model ID, and setting source.

Keep SSL verification enabled. Aider’s configuration reference shown in the refetched .env guide defaults verification to true. A certificate failure is a transport problem to diagnose, not a reason to silently disable verification. Likewise, increasing AIDER_TIMEOUT can help a genuinely slow request, but it cannot repair a wrong model ID, incompatible endpoint family, or missing credential. The same-site guide to client-side timeout handling provides additional boundary-setting principles.

Failure modes

A reliable error path preserves the original evidence, prevents accidental edits, and changes one variable at a time.

SymptomLikely boundaryOperator action
Aider reports that the model is unknownAider lacks metadata for that IDConfirm the ID and capability; treat the warning separately from provider reachability
Provider returns an authentication failureEffective key is absent, rejected, or loaded from the wrong fileCheck environment-file precedence and replace the local value without logging it
Provider returns a not-found responseBase suffix, route, or model ID is wrongRecheck the documented /v1 base and fetch a current catalog ID
Model is found but the request shape is rejectedThe model may require another endpoint familyChoose a model documented for Chat Completions rather than forcing this integration
Connection stalls until Aider times outTransport or service latency exceeded the configured limitRecord latency and retry once after validating the contract; do not loop indefinitely
The first test changes filesPrompt scope or Aider editing behavior was not constrainedStop, inspect the diff, and restore only after deciding which changes are unwanted
A setting appears correct but has no effectA later .env file overrides itIdentify the winning file using Aider’s documented load order
Certificate verification failsHost, network interception, or certificate trust is wrongKeep verification enabled and repair the transport path

Error-path operator workflow

  1. Stop issuing editing prompts. Run git status --short and preserve the current diff for inspection.
  2. Record only sanitized diagnostics: timestamp, local run ID, Aider version, base host, endpoint family, model ID, status code, latency, attempt count, outcome, and changed-file count.
  3. Verify the effective base host and model ID without printing the .env file or any process environment containing the key.
  4. Compare the selected model with the current catalog and verify that it supports Chat Completions.
  5. Run the first-call workflow from the linked CometAPI quick start using the same local model ID. If that call also fails, focus on the provider, credential, model, or endpoint contract. If it succeeds while Aider fails, focus on Aider’s model prefix, environment precedence, and client settings.
  6. Change one setting, retry once with the explanation-only prompt, and record the new outcome. Escalate repeated failures with sanitized evidence rather than a complete transcript.

A compact log record can look like this:

{
  "timestamp": "2026-08-10T00:00:00Z",
  "run_id": "local-01",
  "client": "aider",
  "client_version": "record-locally",
  "base_host": "api.cometapi.com",
  "endpoint_family": "chat-completions",
  "model_id": "CURRENT_CHAT_MODEL_ID",
  "http_status": 0,
  "latency_ms": 0,
  "attempt_count": 1,
  "outcome": "failed",
  "changed_file_count": 0
}

Do not add the .env contents, key value, request headers, prompt body, model response, source code, or full conversation history. Those fields are unnecessary for the first routing diagnosis and can expose secrets or proprietary code.

FAQ

Does the CometAPI model ID need to contain openai/?

No. The catalog ID remains unchanged. Add openai/ only when passing the model to Aider. For example, the conceptual structure is openai/CURRENT_CHAT_MODEL_ID, where the prefix selects Aider’s compatible route and the suffix is the exact provider model ID.

Can I put all settings in .env?

Aider documents .env support for API settings and general options, including the main model and timeout. Keep the file local and ignored. Remember that Aider may load files from the home directory, Git root, current directory, and an explicit path; later files take priority.

Can any CometAPI model be used with Aider?

No. The public catalog includes multiple model types. This workflow needs a model compatible with the chat request Aider sends through its OpenAI-compatible route. A model intended for images, audio, or video is not suitable, and a coding model that requires Responses needs a different integration path.

Why does Aider warn about an unfamiliar model?

The Aider source explicitly notes that warnings can occur for models it does not know. First verify that the model ID is current and that a no-edit request succeeds. Then assess any metadata-dependent behavior separately. A warning is not proof that the provider rejected the request, but it should not be ignored when edit format, context, or other model behavior matters.

Should I disable SSL verification to fix a connection error?

No. Keep verification enabled and diagnose the host, certificate chain, network path, or local interception. Disabling verification hides a transport defect and weakens the connection.

How do I tell a credential problem from an Aider configuration problem?

Use the same model ID in CometAPI’s documented first-call workflow. Failure in both paths points toward the effective credential, model, provider, or endpoint. Success outside Aider narrows the issue to Aider’s prefix, loaded settings, or environment-file precedence. Keep diagnostic output sanitized in both cases.

What should the first prompt do?

Ask Aider to inspect and explain without editing. That separates provider connectivity from file mutation. After a successful response, request one narrowly bounded change, inspect the diff, and run the smallest relevant test before expanding scope.

Reader next step

Choose one current model that explicitly works with Chat Completions, create an ignored .env file, and run the explanation-only prompt. Confirm the selected model, sanitized outcome, and clean repository state before allowing edits. If the direct provider test and Aider test disagree, follow the error-path workflow instead of rotating several settings at once.

When you are ready to create the local credential and test the compatible endpoint, Start with CometAPI .