backend-proxy
Skill0 starsChanged 4 days agoMITView on GitHub
What a proxy server in front of a model must do, and how to point the app's Custom preset at it. Use when an app must ship without the person supplying a key, or the app runs on web.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- actionsSkill
- adding-a-featureSkill
- agent-workflowSkill
- app-contextSkill
- approval-and-safetySkill
- background-workSkill
- build-an-appSkill
- capture-learningsSkill
- clean-architectureSkill
- customizing-the-assistantSkill
- delegate-to-agentSkill
- edit-boundariesSkill
- i18n-and-rtlSkill
- model-providersSkill
- performanceSkill
- permissions-and-platformSkill
- read-the-docsSkill
- reliable-mutationsSkill
- routingSkill
- secretsSkill
- state-managementSkill
- storing-dataSkill
- testingSkill
- ui-designSkill
- upgrade-the-frameworkSkill
- verifySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Don't load this for storing a key the person types.
- Very specific: line 12
If you ship the app without asking people for a key, the key lives on a server you run, and the app talks to that server through the custom …
- Very specific: line 41
No automated check. Test by hand with curl -N against the proxy, then in the app on a real device.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Backend proxy
Don't load this for storing a key the person types; see secrets. For preset and model settings, see model-providers.
Rule
If you ship the app without asking people for a key, the key lives on a server you run, and the app talks to that server through the custom preset. No automated check covers this skill: nothing in the gate tests a proxy.
Why
A key inside the app can be extracted (secrets). Web cannot hold one at all, and browsers also block calls to servers that do not allow them (CORS). A proxy fixes both.
How
The proxy must:
- Accept the OpenAI-compatible request the app sends:
POST <baseUrl>/chat/completionswithmessages, optionaltools, andstream: true.OpenAiCompatibleProviderinpackages/flutter_agentify_core/lib/src/llm/is the client; read it for the exact fields. - Add the key on the server and forward to the real model. With the
custompreset the app sends anauthorizationheader only if a key is saved for it; leave it empty and the proxy adds its own. - Stream the reply back as server-sent events, unbuffered, and end with
data: [DONE]. A proxy that buffers makes the chat look frozen. - Limit use per person: sign-in or a per-device token, a request rate, and a cap on tokens. The app cannot do this for you.
- Send CORS headers for the web origin (and answer
OPTIONS), if the app runs on web. - Pass errors through with their real status (429, 5xx) so
LlmError.retryableworks.
Pointing the app at it: in Settings choose "Custom (OpenAI-compatible)", set the address to the proxy's /v1 root and the model name to one the proxy accepts. Set toolCalling for that model in the advanced section (lib/presentation/settings/assistant_settings_section.dart). The key is optional for custom: leave it empty, or enter a token your proxy checks (not on web). Use https:// for a proxy outside your network; the custom preset refuses http:// to a non-local host, key or not (SetAssistantProvider).
To ship the app already pointing at the proxy, set its values in lib/ai/assistant_setup.dart: ServerSetup(presetId: 'custom', baseUrl: ..., model: ...), with userEditable: false when the person must not change them. Never add a key there. The address is public, so protect the proxy itself with limits.
Anti-patterns
- A proxy with no per-person limit: anyone who finds the address spends your money.
- Putting the real key in the app "just for the demo".
- Rewriting the request into another format in the app; keep the app speaking the one format and translate on the server.
Verification
- No automated check. Test by hand with
curl -Nagainst the proxy, then in the app on a real device. - For app-side behavior against a fake server, see the helpers in
packages/flutter_agentify_core/test/llm/fake_llm_server.dart.
Related skills
secrets— why the key stays off the devicemodel-providers— the Custom preset and web limitspermissions-and-platform— cleartext and local-network settings for non-HTTPS addresses
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

