Exploitation
Add image and video generation to OpenCode
Configure API Stock as a remote MCP server in OpenCode, authenticate and create media alongside your selected coding model.
OpenCode
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"api-stock": {
"type": "remote",
"url": "https://api.api-stock.com/mcp",
"enabled": true
}
}
}opencode mcp auth api-stockopencode mcp listAjoutez le JSON à opencode.json en conservant les entrées existantes, puis connectez-vous dans le navigateur.
Let OpenCode create an image for a page or prepare a video for a prototype. API Stock adds MCP media tools alongside the coding model you selected. Your API Stock balance pays for approved media requests separately.
Add the remote MCP configuration
Merge the JSON shown above into your project's opencode.json, preserving
existing providers, tools and MCP entries. The mcp entry uses type: "remote" and the hosted URL; it contains no account credential.
Run opencode mcp auth api-stock and complete browser sign-in. Review
the requested permissions before approving. OpenCode can attempt dynamic
client registration and keeps its OAuth tokens in its own credential
store. Leave OAuth enabled; an API Stock API key is not an MCP token.
Use opencode mcp list to check server state. In the OpenCode session,
make sure the server's tools are enabled for the selected agent.
Test account access
Use the API Stock MCP tools to call get_account and list_models.Show the balance and available image models. Do not create a generation.
If sign-in fails, run opencode mcp debug api-stock to inspect connectivity
and OAuth discovery. Keep credential files and raw authentication logs
private. A registered connection or public tool list does not prove
authenticated account access.
Generate a file for your project
Start with the landing-page brief or the app asset brief. Ask OpenCode to inspect the current model schema and quote the final input before requesting your approval to spend.
Use maxCostUsd for the approved ceiling. Keep one idempotencyKey per
logical generation and retain the task id when resuming. Wait for a
terminal result before downloading it. Project files and HTTP downloads
need the corresponding OpenCode tool permissions.
For video, inspect a video model's required duration and input media. Quote video separately from the image; one approved image does not authorize another generation. See the video guide.
Connection limits
This configuration follows OpenCode's remote MCP and OAuth contract. Local discovery checks are separate from interactive sign-in and a paid production generation. An available model name does not guarantee that its parameters match another model.
Use opencode mcp logout api-stock to remove local credentials. Revoke
the client's consent in Dashboard → Connectors
to disconnect its server-side access.
References: OpenCode MCP servers and the API Stock MCP reference.

Essayez avec votre propre clé
Choisissez un modèle dans le catalogue API Stock, vérifiez son prix et testez-le dans le navigateur ou par API.