Product AI Integration

DartCodeAI is the AI orchestration layer for the Aortem product suite. Product teams should integrate through the DartCodeAI gateway instead of calling model providers directly.

Integration model

Production AI gateway

https://api.dartcodeai.com

Development AI gateway

https://dev-api.dartcodeai.com

Chat completions

POST /v1/chat/completions

Embeddings

POST /v1/embeddings

Protocol

OpenAI-compatible HTTPS JSON

Required auth

Authorization: Bearer <DartCodeAI OAuth2 access token>

Required product key

x-dartcodeai-product-key

Optional provider override

x-dartcodeai-provider

The gateway validates the OAuth2 access token, resolves tenant context, checks enterprise entitlement, records usage, and routes the request to the configured AI provider.

Product keys

Use one of the canonical product keys below.

Product Product key Billing behavior

DartCodeAI

dartcodeai

External DartCodeAI customers are billable unless their tenant is explicitly zero-rated.

DartCloudFunctions

dartcloudfunctions

Internal suite integration is zero-rated.

DartStream

dartstream

Internal suite integration is zero-rated.

IntelliToggle

intellitoggle

Internal suite integration is zero-rated.

TechniDox

technidox

Internal suite integration is zero-rated.

Do not use legacy product keys such as partner_portal.

Internal suite access

Internal Aortem products receive enterprise-equivalent AI gateway access without going through customer checkout or Stripe billing. This does not mean usage is untracked.

Internal calls still must:

  • use a DartCodeAI-issued OAuth2 client-credentials token

  • send the correct x-dartcodeai-product-key

  • pass normal entitlement checks

  • be recorded to the gateway usage ledger

  • include the product key in the OAuth2 client allow-list

The billing ledger records these requests with zero debit when the product or tenant is configured as zero-rated. This keeps observability, abuse detection, capacity planning, and auditability intact while avoiding internal customer billing.

External customer access

External or non-internal consumers must use the normal DartCodeAI billing path. They need an active enterprise-equivalent entitlement or an enterprise-plus suite entitlement before the gateway will allow billable model traffic.

If a tenant has no credit balance and the request is not zero-rated, the gateway returns 402 Payment Required before calling the upstream model provider.

Provider routing

The gateway supports provider routing through configuration.

Provider key Use

aortem

Aortem proprietary model-serving endpoint running in GKE.

openai

Controlled hosted-model experiments and fallback only.

Production should move to aortem as the default provider after the proprietary inference-module adapter is deployed and verified in GKE. OpenAI should remain restricted to approved experiments, tenant allowlists, or emergency fallback.

Product teams should not call OpenAI directly from product backends. If an experiment needs OpenAI, route it through DartCodeAI with the provider controls above so usage, safety, and billing policy remain centralized.

Chat completion example

curl -X POST https://api.dartcodeai.com/v1/chat/completions \
  -H "Authorization: Bearer $DARTCODEAI_ACCESS_TOKEN" \
  -H "x-dartcodeai-product-key: intellitoggle" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dartcodeai-stable",
    "messages": [
      {
        "role": "system",
        "content": "You are assisting an Aortem product workflow."
      },
      {
        "role": "user",
        "content": "Summarize the feature flag rollout risk."
      }
    ]
  }'

Embeddings example

curl -X POST https://api.dartcodeai.com/v1/embeddings \
  -H "Authorization: Bearer $DARTCODEAI_ACCESS_TOKEN" \
  -H "x-dartcodeai-product-key: technidox" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dartcodeai-embedding-stable",
    "input": "Generate documentation search embedding text."
  }'

Error handling

Status Meaning

400

Missing product key or unsupported provider key.

401

Missing or invalid DartCodeAI OAuth2 bearer token.

402

Billable tenant has insufficient AI credits.

403

Hosted-model provider is restricted for this tenant or product.

503

Configured provider is unavailable or missing required configuration.

Production checklist

Before a product goes live with DartCodeAI:

  • create separate development and production DartCodeAI OAuth2 clients

  • store client secrets in Secret Manager, not frontend code

  • call the gateway from the product backend only

  • send the canonical product key on every request

  • use the default provider unless an experiment explicitly requires OpenAI

  • confirm zero-rated internal usage is visible in the usage ledger

  • confirm external customer usage follows the enterprise billing path