Skip to main content
Glama

SmartAPI Images for Codex

smartapi-images packages a local MCP server and a Codex skill for generating one image through SmartAPI's explicit POST /v1/images/generations endpoint.

The Codex reasoning model remains a text model such as gpt-5.6-sol. When the user asks for an image, Codex calls the generate_image tool, which spends the user's SmartAPI balance and saves the returned image locally.

Requirements

  • Node.js 20 or newer

  • A normal SmartAPI user key with enough available balance

Related MCP server: gpt-image-2-combined

Local setup

corepack pnpm install
corepack pnpm check
export SMARTAPI_API_KEY='sk-smart-...'

The default API URL is https://api.smartapi.shop/v1. Generated files are written to ~/Pictures/SmartAPI by default. Override either setting without editing the repository:

export SMARTAPI_BASE_URL='https://api.smartapi.shop/v1'
export SMARTAPI_IMAGE_OUTPUT_DIR="$HOME/Pictures/SmartAPI"

For a direct Codex MCP configuration:

[mcp_servers.smartapi_images]
command = "node"
args = ["/absolute/path/to/smartapi-images/dist/index.js"]
env_vars = ["SMARTAPI_API_KEY", "SMARTAPI_BASE_URL", "SMARTAPI_IMAGE_OUTPUT_DIR"]
tool_timeout_sec = 360
enabled_tools = ["generate_image"]

Never put a SmartAPI key in .mcp.json, config.toml, source files, logs, or Git.

Tool

generate_image accepts:

  • prompt: required image description

  • size: auto or any WIDTHxHEIGHT; SmartAPI reports the normalized effective size

  • quality: auto, low, medium, or high

  • output_format: png, jpeg, or webp

  • filename: optional safe filename without an extension

The tool never overwrites a file and never retries an ambiguous network or timeout failure. It returns the absolute file path, effective size, charged tokens, and SmartAPI request ID.

Development

corepack pnpm typecheck
corepack pnpm test
corepack pnpm build

Tests use a local mock HTTP server and never call SmartAPI.

Available Tools

1 tool
generate_imageGenerate image with SmartAPIA

Generate one image through the paid SmartAPI gpt-image-2 endpoint and save it as a local file. Use only when the user asks to create an image. The call spends SmartAPI balance.

ParametersJSON Schema
NameRequiredDescriptionDefault
sizeNoRequested WIDTHxHEIGHT or auto. SmartAPI returns the normalized effective size.auto
promptYesDetailed prompt describing the image to generate.
qualityNoImage generation quality.high
filenameNoOptional filename without extension. Existing files are never overwritten.
output_formatNoFile format for the generated image.png

Output Schema

ParametersJSON Schema
NameRequiredDescription
pathYes
request_idYes
output_formatYes
charged_tokensYes
effective_sizeYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds behavioral context beyond annotations: it mentions the tool spends SmartAPI balance, confirms it saves a local file, and notes that existing files are never overwritten (from schema). Annotations are minimal, so the description effectively carries the burden of disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three efficient sentences, front-loaded with the core action. Every sentence adds value: action, usage condition, and cost/behavior. No fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters and an output schema, the description covers the essential behavioral aspects (endpoint, cost, saving) but does not mention the output format or the return structure. It is mostly complete for an agent to understand usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description does not add per-parameter details beyond the schema, but it provides overarching context (paid endpoint, local saving) that indirectly helps. No significant extra parameter-level meaning is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'generate' and the resource 'image', specifying the paid SmartAPI gpt-image-2 endpoint and that it saves as a local file. This is specific and distinguishes the tool from potential alternatives, even though no siblings are listed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Use only when the user asks to create an image.' This provides a clear condition for when the tool should be invoked. However, it does not mention when not to use it or discuss alternatives, but with no siblings the guidance is adequate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.1.0
    • First observedgenerate_image

TDQS

A4.1/5.0
Disambiguation5/5

Only one tool exists, so there is no possibility of confusion between tools.

Naming Consistency5/5

With a single tool, naming is trivially consistent.

Tool Count3/5

One tool is very thin for a typical server, but it may be acceptable if the scope is strictly image generation via a paid endpoint.

Completeness2/5

The tool only covers generating an image; there are no tools for managing past images (list, delete) or configuring generation parameters beyond the prompt, leaving obvious gaps.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/smrcdr/smartapi-images'

If you have feedback or need assistance with the MCP directory API, please join our Discord server