API Stock

운영

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.

2분 분량4개 섹션

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-stock
opencode mcp list

기존 항목을 유지하면서 JSON을 opencode.json에 병합한 다음 브라우저에서 인증하세요.

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

text
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.

직접 발급한 키로 실행해 보세요

API Stock 카탈로그에서 모델과 가격을 확인하고 브라우저나 API로 사용해 보세요.

이어서 읽기