LLM setup
Copy this into Codex, Cursor, Claude Code, or Windsurf.
This prompt tells an AI coding assistant to integrate MargIQ safely: server-side only, no hardcoded secrets, and no browser exposure of MargIQ credentials.
You are helping me add MargIQ to an existing AI application.
Goal:
- Keep the current OpenAI-compatible code path working.
- Add MargIQ from a server-side module, never from browser code.
- Add only the MargIQ-specific environment variable: MARGIQ_API_KEY.
- Use MargIQ Cloud defaults; do not add custom MargIQ infrastructure settings unless the team explicitly has a private deployment.
- Preserve the app's existing model-provider credentials and base URL configuration.
- Wrap the existing OpenAI-compatible client with the MargIQ SDK.
- Pass provider and availableModels to MargIQ so routing stays inside your available model list.
- Keep the requested model in each call as the quality anchor.
- Use the wrapped client exactly like the original provider client.
- Send one low-risk verification request and confirm a transaction appears in the MargIQ dashboard.
Constraints:
- Preserve existing request/response behavior.
- Do not hardcode secrets.
- Do not expose MARGIQ_API_KEY in frontend/browser bundles.
- Do not manually call MargIQ recommendation or event endpoints from product code.
- Do not expect MargIQ metadata on the LLM response object; evidence appears in dashboard transactions.
- If the app uses a provider-specific base URL, preserve the existing provider client configuration.
- MargIQ should choose only from the models listed in availableModels.
- Keep the change minimal and easy to review.
- Explain what changed after implementation.Short version
Add MargIQ to this repository.
Keep existing model calls working.
Wrap the server-side OpenAI-compatible client with MargIQ.
Add only MARGIQ_API_KEY as the MargIQ-specific environment variable.
Preserve the app's existing provider credentials and base URL.
Pass provider and availableModels to MargIQ.
Choose from your available models and keep the requested model as fallback.
Run a small verification request.
Do not expose MargIQ keys in browser code.
Do not manually call MargIQ backend endpoints from product code.What the agent should produce
- SDK installation and imports.
- Only MARGIQ_API_KEY for MargIQ credentials.
- No replacement of the app's existing provider credential setup.
- A wrapped OpenAI-compatible client.
- A provider value and available model list.
- A verification request that appears in dashboard transactions.
- A note that response objects stay provider-compatible.
Review rule
Reject any integration that hardcodes provider credentials, replaces your provider SDK unnecessarily, or imports MargIQ from browser code.