👾Code Agents with Token Factory
This explains how to connect popular code agents to Token Factory through the FPT AI Marketplace.
Use it to configure endpoints, API keys, an internal proxy, and the right model for each tool. See Task recommendation by roles to select an LLM for each task.
Use code agents effectivelyi
Give AI models clear instructions to prevent endless agent loops and incorrect implementation paths. This prevents endless agent loops and incorrect implementation paths.
Instruction principles — use English where possible:
Use
AGENTS.md— place it at the repository root. Agents read its context, working principles, and common commands at session start. OpenCode, Cline, and Roocode support this automatically. This instruction includes anAGENTS.mdfile.AGENTS.md→ for OpenCode (Sisyphus)CLAUDE.md→ for Claude CLI (claude)
Keep prompts short, specific, and example-driven — instead of "fix the auth", write: "In
auth.py:45, replacetoken = req.headers.get('token')withtoken = req.headers.get('Authorization', '').removeprefix('Bearer ')"Control code loops — when an agent repeats work without progress, use: "Stop. Summarize what you've tried and what's blocking you." You can also add a stopping condition: "If you can't fix it in 3 attempts, stop and explain."
Break tasks into smaller steps — "Only do step 1: write the function. Don't run or test yet." Always ask the agent to plan first, then execute: "List the steps you'll take. Don't execute yet."
API Endpoint: https://mkp-api.fptcloud.com/v1
Company proxy: http://10.36.232.10:8080
1. OpenCode
Installation
# Request administrator access at: https://uservice.fci.vn/secure/SSC01CreateTicket.jspa?processId=147&catalogId=2&issueKeys=
# Select the Whitelist option.
# Install Node.js LTS.
winget install OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements
# Install OpenCode with npm, Scoop, or Chocolatey.
npm install -g opencode-ai
# Or run: scoop install opencode / choco install opencodeAPI configuration
File: %USERPROFILE%\.config\opencode\opencode.jsonc
Run on Windows
Ubuntu
Installation:
Or use npm:
API configuration:
Create the OpenCode directory if needed: mkdir $HOME/.config/opencode
Create opencode.jsonc: touch $HOME/.config/opencode/opencode.jsonc
Create an API key for Qwen 3.6-27B in the AI Marketplace: https://marketplace.fptcloud.com/
Update $HOME/.config/opencode/opencode.jsonc:
Run:
Optional
For an improved experience, install the oh-my-openagent plugin.
2. Cline (VS Code extension)
Install the Cline extension in VS Code.
Open Cline Settings → select API Provider: OpenAI Compatible.
Enter:
Base URL
https://mkp-api.fptcloud.com/v1
API Key
<API_KEY>
Model
Qwen3.6-27B
Configure the proxy in VS Code settings (
settings.json):
3. Roocode (VS Code extension)
See the OpenAI-compatible provider connection guide.
Enter:
Base URL:
https://mkp-api.fptcloud.com/v1API Key:
<API_KEY>Model:
Qwen3.6-27B
4. Claude CLI with FPT AI Marketplace
Claude CLI sends API keys in the Anthropic-style x-api-key header. FPT AI Marketplace requires Authorization: Bearer. The following configuration overrides environment variables for marketplace compatibility. It also uses a separate configuration directory to avoid conflicts with a claude.ai account.
Note: The following configuration uses the MODAS Vietnam site only
Configuration — add to your PowerShell profile
Open your profile:
Add this to the end of the file:
Commands
claude-mkp
Runs Claude CLI through MKP
claude-mkp <args>
Passes additional arguments as usual
ccdm
Runs with --dangerously-skip-permissions
Temporarily change the model:
Ubuntu
Add this to ~/.bashrc or ~/.zshrc:
Temporarily change the model:
Why use ANTHROPIC_AUTH_TOKEN instead of ANTHROPIC_API_KEY?
x-api-key: sk-...
ANTHROPIC_API_KEY
No → 401
Authorization: Bearer sk-...
ANTHROPIC_AUTH_TOKEN
Yes → 200 OK
Test the connection
Troubleshooting
Auth conflict warning
Ensure CLAUDE_CONFIG_DIR is set inside the function, not globally.
Retrying in Xs · attempt N/10
MKP rejected authentication. Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY.
401 "Missing API Key"
The header is incorrect. Use Authorization: Bearer, not x-api-key.
Last updated
Was this helpful?
