Forwarding CometAPI-specific request options without forking the AI SDK adapter

Forward CometAPI request fields through AI SDK before forking the adapter

If your TypeScript chat integration only needs to add a request-body field that CometAPI’s endpoint documentation explicitly supports, try configuration before maintenance-heavy adapter code. CometAPI documents an OpenAI-compatible chat endpoint at https://api.cometapi.com/v1, authenticated with an API key, with the usual model and messages inputs.

The AI SDK’s OpenAI Compatible Provider exposes the relevant seam: create the provider with that base URL and key, then put the provider-specific field in providerOptions under the provider instance’s name. The namespace is camelCase: a provider named comet-api is addressed as providerOptions.cometApi. The field is then forwarded into the request body, so a transport-only extension does not require forking the provider or SDK.

That conclusion is deliberately narrow. The SDK documentation’s customOption is an example of forwarding, not proof that CometAPI accepts customOption (or any particular value). CometAPI’s compatibility page likewise does not establish a specific custom field, its semantics, or support across models. Use only a field and value documented for the endpoint you selected.

Keep three checks separate:

  1. Construction: did the SDK put the intended key and value in the outgoing body?
  2. Acceptance: does the selected CometAPI endpoint accept that body for the selected model?
  3. Effect: does the model actually apply the option as intended?

Only the first follows from the provider-options mechanism. Validate the latter two with the endpoint and model documentation, then with a credentialed integration test in your own environment. If the requirement instead changes response parsing, needs arbitrary body transformation, or lacks an endpoint contract, this no-fork recommendation no longer follows; choose an adapter or application-layer change based on that concrete requirement.

For a copy-production workflow, I would add a separate decision after those three checks: does the option improve the deliverable enough to become part of the saved recipe? A field can have its intended effect without making the copy more usable.

For example, take a brief requiring three caption variants, each within an agreed character limit and with a mandatory product disclaimer. Once a field and value are documented for the chosen endpoint and model, compare the existing recipe against the same recipe with that option enabled. Keep the brief, prompt and model fixed, review several outputs from each, and assess both constraint compliance and the edits needed before approval. Treat that as a proposed local comparison, not evidence of any CometAPI option’s behavior.

I would save the exact field/value alongside the prompt version and editorial acceptance criteria rather than expose an unexplained setting to every editor. If the outputs still need the same corrections, leave the option out of the production recipe even if forwarding and acceptance pass. Avoiding an adapter fork simplifies the integration; deciding which controls belong in the creative workflow is a separate maintenance choice.