Skip to content

feat: add deAPI as embeddings provider - #2492

Closed
adampachowicz wants to merge 4 commits into
theopenco:mainfrom
deapi-ai:add-deapi-provider
Closed

adampachowicz wants to merge 4 commits into
theopenco:mainfrom
deapi-ai:add-deapi-provider

Conversation

@adampachowicz

@adampachowicz adampachowicz commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds deAPI (deapi.ai) as a new OpenAI-compatible inference provider, exposing its multilingual BGE-M3 embedding model as deapi/bge-m3.

Disclosure: I'm contributing this on behalf of deAPI (operated by CoinAxe Ltd) — i.e. I'm affiliated with the provider.

deAPI serves a native /v1/embeddings endpoint and does not offer chat completions, so this PR is scoped to embeddings only. Image/audio modalities are intentionally left for follow-ups.

Implementation

  • Register deapi in packages/models/src/providers.ts + model definition in packages/models/src/models/deapi.ts, wired into the models aggregate.
  • Base URL https://oai.deapi.ai resolved in the embeddings route (providerBaseUrlDefaults) and in get-provider-endpoint.ts.
  • Bearer auth via the existing default group (get-provider-headers.ts).
  • Embeddings-only provider key validation: getValidationModel deliberately excludes embedding models, so for an embeddings-only provider there is no chat model to validate against and key creation would throw No suitable validation model found. Added a minimal early-return mirroring the existing custom provider — it fires only when every model for the provider is embeddings-only, so chat-capable providers are never affected. deAPI is the first embeddings-only provider in the repo, hence this change.
  • deAPI icon (currentColor, themeable) registered in the icon + provider-logo maps.

Models

Model deAPI model id Output Dimensions Price / 1M tokens Context
deapi/bge-m3 Bge_M3_FP16 embedding 1024 ~$0.13 ¹ 8192

¹ Derived from deAPI's price-calculation API; the exact configured rate will be confirmed/adjusted before merge.

Test plan

  • pnpm build — ✅ all core packages typecheck
  • pnpm test:unit — ✅ 73/73 on the models + endpoint-resolution specs
  • pnpm format — ✅
  • Live smoke test against deAPI production: POST https://oai.deapi.ai/v1/embeddings with model Bge_M3_FP16 → HTTP 200, returns a valid 1024-dimensional embedding vector. ✅

Note on usage accounting: deAPI's /v1/embeddings response currently returns usage.prompt_tokens: 0, so gateway-side cost tracking will read $0 until deAPI surfaces token usage (a fix is in progress on the deAPI side). The embedding output itself is correct and complete.

I'm happy to adjust naming, pricing, or scope to match your conventions — thanks for maintaining this project.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added deAPI as a new LLM provider with support for the bge-m3 embedding model.
    • deAPI appears in the UI with its provider logo.
    • Users can configure deAPI via an API key and optional custom base URL; a sensible default endpoint is used.
    • Embeddings-only providers (like deAPI) are accepted during key validation without requiring chat-capable models.
  • Documentation

    • Example environment configuration updated with deAPI placeholders.

Register deAPI (https://deapi.ai), an OpenAI-compatible inference platform
operated by GamerHash, exposing its multilingual BGE-M3 embedding model
(deapi/bge-m3). deAPI serves a native /v1/embeddings endpoint and does not
offer chat completions, so this scopes to embeddings only.

- Provider + model registration (providers.ts, models/deapi.ts, models.ts)
- Base URL https://oai.deapi.ai in the embeddings route + endpoint resolver
- Bearer auth (existing default group)
- Embeddings-only provider key validation (deAPI is the first such provider;
  getValidationModel excludes embedding models, so validation is skipped only
  when every model for the provider is embeddings-only, mirroring 'custom')
- deAPI icon (currentColor, themeable)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3e69bd70-328a-48c0-8e2f-0afec61db11f

📥 Commits

Reviewing files that changed from the base of the PR and between 8de194a and c106aec.

📒 Files selected for processing (1)
  • packages/models/src/providers.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/models/src/providers.ts

Walkthrough

Registers deAPI as a new provider (env example, provider registry), adds bge-m3 embeddings model, resolves deAPI base URLs and bearer-token headers, adjusts validation to accept embeddings-only providers, and wires UI icon/logo entries and embeddings upstream default.

Changes

deAPI provider integration

Layer / File(s) Summary
Provider and model registration
packages/models/src/providers.ts, .env.example, packages/models/src/models/deapi.ts, packages/models/src/models.ts
Provider metadata (id: "deapi"), required LLM_DEAPI_API_KEY and optional LLM_DEAPI_BASE_URL, and bge-m3 embedding model definition (pricing, 8192 context) are registered; streaming and cancellation disabled; models import/composition updated.
Request routing and authentication
packages/actions/src/get-provider-endpoint.ts, packages/actions/src/get-provider-headers.ts, apps/gateway/src/embeddings/embeddings.ts
deAPI base URL resolves to https://oai.deapi.ai; provider added to bearer-token header switch to return Authorization: Bearer <token>; embeddings provider defaults include deAPI upstream mapping.
Provider validation for embeddings-only models
packages/actions/src/validate-provider-key.ts
When no chat-capable validation model exists, validation now returns { valid: true } if every model mapping for the provider is embeddings-only.
UI provider presentation
packages/shared/src/components/provider-icons.tsx, apps/ui/src/components/provider-keys/provider-logo.ts
New DeAPIIcon SVG component is added and registered in ProviderIcons, dark-mode class mapping updated, and providerLogoUrls extended to resolve deAPI logo.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • steebchen
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add deAPI as embeddings provider' directly and clearly summarizes the main change: adding a new embeddings provider to the system.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/shared/src/components/provider-icons.tsx (1)

1288-1288: ⚡ Quick win

Remove unnecessary comment.

The export name DeAPIIcon is self-documenting; the comment adds no additional value.

As per coding guidelines: "No unnecessary code comments" for TypeScript files.

♻️ Proposed fix
-// deAPI Icon
 export const DeAPIIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/shared/src/components/provider-icons.tsx` at line 1288, Remove the
redundant inline comment "// deAPI Icon" that precedes the export of DeAPIIcon;
the export name DeAPIIcon is self-documenting, so delete that comment near the
DeAPIIcon declaration/export in provider-icons.tsx to comply with the "No
unnecessary code comments" guideline.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/models/src/providers.ts`:
- Around line 1142-1143: Update the deAPI provider entry in providers.ts by
replacing the null values for the termsUrl and privacyPolicyUrl fields with the
official deAPI links; specifically set termsUrl to
"https://deapi.ai/terms-of-service" and privacyPolicyUrl to
"https://deapi.ai/privacy-policy" in the object that contains the termsUrl and
privacyPolicyUrl properties.
- Around line 1124-1145: Add a dataPolicy object to the provider entry with id
"deapi" in providers.ts: set apiTraining: false and consumerTraining: false, set
retentionPeriod to a short/transient value (e.g., "brief_post-processing" or
"transient") to reflect brief retention after processing, set promptLogging to
null and explicitly set certification flags (soc2, iso27001, etc.) to null with
a short rationale string (e.g., "not documented publicly") where deAPI
documentation does not assert them, and include a short human-readable note that
deAPI is a data processor and users remain data controllers and should avoid
submitting sensitive/PII. Ensure the new dataPolicy field is added inside the
same provider object that has id "deapi".

In `@packages/shared/src/components/provider-icons.tsx`:
- Around line 1291-1295: The JSX element currently spreads {...props} and then
redundantly sets className={props.className}; remove the explicit
className={props.className} property so the className from the props spread is
used exclusively (leave {...props} intact) — locate the element in
provider-icons.tsx where {...props} and className={props.className} appear and
delete the explicit className attribute.

---

Nitpick comments:
In `@packages/shared/src/components/provider-icons.tsx`:
- Line 1288: Remove the redundant inline comment "// deAPI Icon" that precedes
the export of DeAPIIcon; the export name DeAPIIcon is self-documenting, so
delete that comment near the DeAPIIcon declaration/export in provider-icons.tsx
to comply with the "No unnecessary code comments" guideline.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5223fd29-0baa-4114-be13-528ab990ebb7

📥 Commits

Reviewing files that changed from the base of the PR and between 3f13974 and 2305ee5.

📒 Files selected for processing (10)
  • .env.example
  • apps/gateway/src/embeddings/embeddings.ts
  • apps/ui/src/components/provider-keys/provider-logo.ts
  • packages/actions/src/get-provider-endpoint.ts
  • packages/actions/src/get-provider-headers.ts
  • packages/actions/src/validate-provider-key.ts
  • packages/models/src/models.ts
  • packages/models/src/models/deapi.ts
  • packages/models/src/providers.ts
  • packages/shared/src/components/provider-icons.tsx

Comment thread packages/models/src/providers.ts
Comment thread packages/models/src/providers.ts Outdated
Comment thread packages/shared/src/components/provider-icons.tsx Outdated
- Set BGE-M3 price to $0.068/1M tokens (confirmed configured rate)
- Add deAPI terms of service + privacy policy URLs
- Drop redundant className prop on the deAPI icon (covered by {...props})

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
adampachowicz and others added 2 commits June 2, 2026 15:41
Populate dataPolicy from deAPI's published privacy policy: 90-day API log
retention, GDPR (EU/processor). Model-training flags left null since the
policy does not make a no-training claim, and promptLogging is true given
API logs are retained and processing may occur on distributed third-party
nodes — kept accurate rather than over-claiming privacy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Align provider description and headquarters with deAPI's published legal
entity (CoinAxe Ltd, registered in Malta) per its terms/privacy policy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@steebchen

Copy link
Copy Markdown
Member

please contact us at contact@llmgateway.io for listing requests

@steebchen steebchen closed this Jun 2, 2026
pull Bot pushed a commit to soitun/llmgateway that referenced this pull request Jun 3, 2026
## Summary

Several provider icon components set `className={props.className}`
explicitly **right after** spreading `{...props}` onto the same `<svg>`.
Since `{...props}` already includes `className`, the explicit prop is
redundant (it just re-assigns the same value).

This removes the redundant prop from the affected icons:
`AnthropicIcon`, `DeepseekIcon`, `GroqIcon`, `InferenceNetIcon`,
`MinimaxIconStatic`, `MinimaxIcon`, `XiaomiIcon`, `DeepInfraIcon`.

The `cn("…", props.className)` merges (which intentionally combine extra
classes with the caller's `className`) are **left untouched** — those
are not redundant.

## Notes

- No behavior change — `className` still flows through via `{...props}`.
- Prettier collapsed a few now-shorter `<svg>` tags onto single lines.

This came up while CodeRabbit was reviewing theopenco#2492 (adding the deAPI
provider); it flagged the redundant prop on the new icon, and I noticed
the same pattern existed across the existing icons, so here's a small
repo-wide cleanup. Happy to adjust or drop it if you'd prefer to keep it
as-is.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Updated icon component prop forwarding mechanism for improved
consistency and maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
analogpvt pushed a commit to analogpvt/llmgateway that referenced this pull request Jun 5, 2026
## Summary

Several provider icon components set `className={props.className}`
explicitly **right after** spreading `{...props}` onto the same `<svg>`.
Since `{...props}` already includes `className`, the explicit prop is
redundant (it just re-assigns the same value).

This removes the redundant prop from the affected icons:
`AnthropicIcon`, `DeepseekIcon`, `GroqIcon`, `InferenceNetIcon`,
`MinimaxIconStatic`, `MinimaxIcon`, `XiaomiIcon`, `DeepInfraIcon`.

The `cn("…", props.className)` merges (which intentionally combine extra
classes with the caller's `className`) are **left untouched** — those
are not redundant.

## Notes

- No behavior change — `className` still flows through via `{...props}`.
- Prettier collapsed a few now-shorter `<svg>` tags onto single lines.

This came up while CodeRabbit was reviewing theopenco#2492 (adding the deAPI
provider); it flagged the redundant prop on the new icon, and I noticed
the same pattern existed across the existing icons, so here's a small
repo-wide cleanup. Happy to adjust or drop it if you'd prefer to keep it
as-is.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Updated icon component prop forwarding mechanism for improved
consistency and maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants