Skip to content

GAT-00001: Add /v1/embeddings endpoint - #6

Merged
andrei-hasna merged 1 commit into
mainfrom
openloops/open-gateway/4cf413d2-fd1e-4882-9659-a2514392169d-8bc09698
Jul 24, 2026
Merged

GAT-00001: Add /v1/embeddings endpoint#6
andrei-hasna merged 1 commit into
mainfrom
openloops/open-gateway/4cf413d2-fd1e-4882-9659-a2514392169d-8bc09698

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • Add OpenAI-compatible POST /v1/embeddings handling through gateway auth, routing, provider fallback, budgets, usage normalization, and ledger recording.
  • Make routing operation-aware so chat still requires chat/streaming/tools capabilities while embeddings require embeddings capability.
  • Add OpenAI-compatible provider /embeddings request building and embeddings-specific usage serialization.

Validation

  • bun install
  • bun test (64 pass)
  • bun run typecheck
  • bun run build
  • staged secrets scan over git diff --cached --no-ext-diff found no credential-shaped matches before commit

Adversarial Review

  • Checked that chat routing remains the default for existing resolveRoute(options, request) callers.
  • Changed new provider adapter methods to optional to avoid breaking external TypeScript adapters; gateway fails closed if an embeddings model is configured for an adapter without embed support.
  • Verified embedding request input is not written to the usage ledger and postflight hard-budget failures still record spend before rejecting.

Task: 4cf413d2-fd1e-4882-9659-a2514392169d

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

OpenLoops worker update for task 738dfa4a-e136-469f-861d-afe21f16ab2b.

Code blocker found by adversarial review was fixed and pushed as de7ce10 (fix: redact MCP route explanation output). Changed files: src/mcp/index.ts, tests/mcp.test.ts.

Validation passed locally on the fixed PR head and again on a no-commit merge of the fixed PR into current origin/main (2fab81cf9bc9b5bc6aed3408933db6f82e5fdc30):

  • bun test tests/mcp.test.ts: 6 pass, 0 fail
  • bun run typecheck: pass
  • bun test: 64 pass, 0 fail
  • bun run build: pass
  • staged/pre-push scans: no high-confidence credential/private-key matches; broad hits were only deliberate redaction-test placeholders.

Current GitHub PR state after push: OPEN, non-draft, mergeable=MERGEABLE, mergeStateStatus=CLEAN, headRefOid=de7ce10ddaa1c5d760be7f60916a87bfc9388a71, no status checks reported, reviewDecision empty.

Merge is currently blocked on formal non-author review/access. Current gh auth is andrei-hasna, which is the PR author. The selected non-author reviewer from task routing is kriptoburak, but GitHub rejected the REST reviewer request with HTTP 422 because reviews may only be requested from collaborators and kriptoburak is not a collaborator on hasna/gateway. Follow-up todos task cce45f04 records the access gate.

@andrei-hasna
andrei-hasna force-pushed the openloops/open-gateway/4cf413d2-fd1e-4882-9659-a2514392169d-8bc09698 branch 3 times, most recently from 874c243 to 5bacbb8 Compare July 24, 2026 14:09
Add POST /v1/embeddings through gateway auth, operation-aware routing,
provider fallback, budgets, usage normalization, per-gateway-key rate
limiting, and best-effort ledger recording. Embedding input is never
written to the usage ledger; post-flight hard-budget failures still
record spend before rejecting.

Routing is now operation-aware: chat requires chat/streaming/tools
capabilities while embeddings require the embeddings capability. The
OpenAI-compatible adapter builds /embeddings requests and serializes
embeddings-specific usage.

Rebased onto current main (readiness, contracts, Anthropic/Gemini
adapters, per-gateway-key rate limiting); embeddings now enforces the
same rate limits and threads env into budget evaluation for parity with
chat. Bump 0.1.5 -> 0.1.6.
@andrei-hasna
andrei-hasna force-pushed the openloops/open-gateway/4cf413d2-fd1e-4882-9659-a2514392169d-8bc09698 branch from 5bacbb8 to 87fc3c1 Compare July 24, 2026 14:12
@andrei-hasna
andrei-hasna merged commit dab08ca into main Jul 24, 2026
1 check passed
@andrei-hasna
andrei-hasna deleted the openloops/open-gateway/4cf413d2-fd1e-4882-9659-a2514392169d-8bc09698 branch July 24, 2026 14:12
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.

1 participant