Skip to content

feat(context-dev): add Context.dev to hosted key rotation pool#5576

Merged
waleedlatif1 merged 1 commit into
stagingfrom
worktree-feat+context-dev-hosted-keys
Jul 10, 2026
Merged

feat(context-dev): add Context.dev to hosted key rotation pool#5576
waleedlatif1 merged 1 commit into
stagingfrom
worktree-feat+context-dev-hosted-keys

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add Context.dev to the hosted-key mechanism, mirroring Exa's pattern exactly
  • New apps/sim/tools/context_dev/hosting.ts shared helper: CONTEXT_DEV_API_KEY env prefix (_COUNT + _1..N rotation), byokProviderId: 'context_dev', per_request rate limit (60/min)
  • All 22 context_dev_* tools wired with hosting: contextDevHosting<...>()
  • Cost is computed from each response's actual credits_consumed (already surfaced as output.creditsConsumed) rather than a hardcoded per-endpoint guess — more accurate than static estimates since Context.dev reports real usage per call
  • context_dev added to BYOKProviderId, byokProviderIdSchema, and the Settings → BYOK UI (Search & web section, next to Exa/Firecrawl)
  • Block's API Key field gets hideWhenHosted: true — no operation split needed since all 22 ops support hosted keys (unlike Exa, which excludes research)
  • .env.example documents CONTEXT_DEV_API_KEY_COUNT/1/2

Type of Change

  • New feature

Testing

  • bun run check:api-validation passes
  • bunx tsc --noEmit clean on touched files (1 pre-existing unrelated error elsewhere on staging)
  • bunx vitest run tools/context_dev/ tools/index.test.ts blocks/blocks.test.ts — 168/168 passing
  • bun run lint clean

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Wires all 22 context_dev tools into the same hosted-key mechanism as
Exa: CONTEXT_DEV_API_KEY_COUNT/1..N rotation, BYOK provider
registration, and hideWhenHosted on the block's API key field. Cost
is read directly from each response's reported credits_consumed
rather than estimated per endpoint.
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 10, 2026 10:46pm

Request Review

@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches hosted-key billing and API key resolution for a large tool surface; misconfigured pricing or key rotation could affect cost accounting or outbound calls, but the pattern matches existing providers like Exa.

Overview
Adds hosted API key support for Context.dev so deployments can supply CONTEXT_DEV_API_KEY_COUNT / _1..N keys and workflows can run without users entering a key when hosting is enabled.

A shared contextDevHosting() helper wires env prefix, BYOK provider context_dev, 60/min per-request rate limiting, and usage-based pricing from each response’s creditsConsumed (not fixed per-endpoint costs). All 22 Context.dev tools attach that hosting config.

BYOK is extended end-to-end: provider id in types and API contracts, Settings → BYOK under Search & web, and the Context.dev block API key field uses hideWhenHosted: true. .env.example documents the new env vars; hosting.test.ts covers pricing and hosting metadata.

Reviewed by Cursor Bugbot for commit cd882b5. Configure here.

Comment thread apps/sim/tools/context_dev/hosting.ts
@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Context.dev to the hosted-key and BYOK flow. The main changes are:

  • New Context.dev hosted-key helper with rotating environment keys.
  • Hosted pricing based on reported creditsConsumed.
  • Context.dev BYOK provider support in contracts and Settings.
  • Hosted-key wiring across the Context.dev tools.
  • Hosted deployments hide the block-level Context.dev API key field.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/tools/context_dev/hosting.ts Adds the shared Context.dev hosted-key config, credit-based pricing, BYOK provider id, and rate limit settings.
apps/sim/tools/context_dev/*.ts Adds the Context.dev hosting helper to the tool configs.
apps/sim/blocks/blocks/context_dev.ts Hides the Context.dev API key field on hosted deployments.
apps/sim/lib/api/contracts/byok-keys.ts Adds context_dev to the BYOK provider schema.
apps/sim/app/workspace/[workspaceId]/settings/components/byok/byok.tsx Adds Context.dev to the BYOK Settings provider list.

Reviews (2): Last reviewed commit: "feat(context-dev): add Context.dev to ho..." | Re-trigger Greptile

Comment thread apps/sim/tools/context_dev/hosting.ts
Comment thread apps/sim/tools/context_dev/hosting.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit cd882b5. Configure here.

@waleedlatif1 waleedlatif1 merged commit 65b1ca1 into staging Jul 10, 2026
29 of 30 checks passed
@waleedlatif1 waleedlatif1 deleted the worktree-feat+context-dev-hosted-keys branch July 10, 2026 22:58
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