# How to Integrate GPT-Image2 Style Library with Claude Code and Codex

> Integrate GPT-Image2 Style Library with Claude Code and Codex. Access programmatic prompt generation using the npm package and standard manifests for seamless integration.

- Repository: [苍何/awesome-gpt-image-2](https://github.com/freestylefly/awesome-gpt-image-2)
- Tags: how-to-guide
- Published: 2026-09-13

---

**Both Claude Code and Codex consume the `gpt-image-2-style-library` skill through standardized manifests and an npm package, enabling programmatic prompt generation via the `generatePrompt()` function and HTTP endpoints.**

The `freestylefly/awesome-gpt-image-2` repository ships a reusable skill that centralizes prompt templates for image generation. By integrating this library with Claude Code and Codex, developers can programmatically access categorized styles, scenes, and templates stored in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) to generate consistent, high-quality prompts without manual template management.

## Architecture of the GPT-Image2 Style Library

The integration relies on a three-tier architecture that separates data storage from runtime invocation. At the foundation, **[`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json)** serves as the single source of truth for categories, styles, scenes, and template metadata (lines 1‑190). The middle tier consists of the skill package located at `agents/skills/gpt-image-2-style-library/`, which bundles the data with runtime scripts including `bin/generate.mjs` for prompt construction and `bin/install.mjs` for service setup. The top tier comprises provider-specific manifests—[`agents/skills/gpt-image-2-style-library/agents/openai.yaml`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/agents/openai.yaml) for OpenAI models and [`.claude-plugin/marketplace.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/.claude-plugin/marketplace.json) for Claude Code—that expose the skill's HTTP interface to each respective platform.

### Key Files in the Repository

- **[`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json)**: Contains the master catalog of templates and style definitions (lines 1‑190).
- **[`agents/skills/gpt-image-2-style-library/SKILL.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/SKILL.md)**: Human-readable description of the skill used by marketplaces.
- **[`agents/skills/gpt-image-2-style-library/package.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/package.json)**: Defines the npm package entry points and dependencies.
- **`agents/skills/gpt-image-2-style-library/bin/generate.mjs`**: Implements the core **`generatePrompt`** logic that assembles final prompt strings from templates.
- **`agents/skills/gpt-image-2-style-library/bin/install.mjs`**: Initializes the HTTP service required for Claude Code integration.
- **[`agents/skills/gpt-image-2-style-library/agents/openai.yaml`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/agents/openai.yaml)**: Manifest template for OpenAI/Codex integration.
- **[`.claude-plugin/marketplace.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/.claude-plugin/marketplace.json)**: Claude Code marketplace manifest that registers the skill for Anthropic's platform.

## Integrating with Claude Code

Claude Code discovers external tools through manifest files placed in the `.claude-plugin/` directory. To enable the GPT-Image2 Style Library, Claude reads [`.claude-plugin/marketplace.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/.claude-plugin/marketplace.json) at startup and exposes the skill as an available tool.

### Configuring the Claude Manifest

The Claude manifest follows a JSON schema that describes the skill's HTTP endpoint and input/output schemas. Based on the OpenAI manifest structure found in [`agents/skills/gpt-image-2-style-library/agents/openai.yaml`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/agents/openai.yaml), you define the integration in [`.claude-plugin/marketplace.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/.claude-plugin/marketplace.json):

```json
{
  "name": "gpt-image-2-style-library",
  "description": "Prompt templates for GPT-Image-2",
  "type": "http",
  "url": "https://your-deployment.com/gpt-image-2-style-library/generate",
  "input_schema": {
    "type": "object",
    "properties": {
      "templateId": { "type": "string" },
      "customizations": { "type": "object" }
    },
    "required": ["templateId"]
  },
  "output_schema": {
    "type": "object",
    "properties": { "prompt": { "type": "string" } }
  }
}

```

### Invoking the Skill from Claude Prompts

Once registered, Claude Code routes requests to the skill's HTTP endpoint automatically. You invoke the tool by specifying the template ID and customizations in your conversation:

```json
{
  "name": "gpt-image-2-style-library",
  "input": {
    "templateId": "ui-screenshot-system",
    "customizations": {
      "platform": "iOS",
      "aspectRatio": "16:9",
      "title": "My New App"
    }
  }
}

```

Claude forwards this payload to the `/generate` endpoint exposed by `agents/skills/gpt-image-2-style-library/bin/install.mjs`, which calls **`generatePrompt()`** from `agents/skills/gpt-image-2-style-library/bin/generate.mjs` to retrieve the template from [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) and return the assembled prompt string.

## Integrating with Codex

Codex integrates with the style library as a standard npm module rather than through a plugin manifest. This approach leverages the JavaScript runtime directly, importing the skill package and calling functions programmatically.

### Installing the Package

Install the skill package directly from the repository or via the scoped npm package referenced in [`agents/skills/gpt-image-2-style-library/package.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/package.json):

```bash
npm install @gpt-image-2/style-library

```

### Using generatePrompt Programmatically

Import the **`generatePrompt`** function from the package and invoke it with a **templateId** and customization object. This function reads from the same [`style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/style-library.json) source used by the Claude Code integration:

```javascript
import { generatePrompt } from '@gpt-image-2/style-library';

async function createImagePrompt() {
  const prompt = await generatePrompt({
    templateId: 'infographic-engine',
    customizations: {
      theme: 'Tech',
      title: 'AI Pipeline Overview'
    }
  });

  // Send to Codex model
  const response = await openai.createCompletion({
    model: 'code-davinci-002',
    prompt,
    max_tokens: 500
  });
  
  return response.data.choices[0].text;
}

```

### Direct API Integration

For Codex deployments that require HTTP access, you can mirror the Claude setup by serving the skill through a lightweight Node.js server. The `agents/skills/gpt-image-2-style-library/bin/install.mjs` script initializes this server, exposing the `/generate` endpoint that accepts POST requests with `templateId` and `customizations` parameters, returning JSON containing the **prompt** field.

## Summary

- The **GPT-Image2 Style Library** centralizes prompt templates in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json), providing a single source of truth for both Claude Code and Codex integrations.
- **Claude Code** consumes the skill via [`.claude-plugin/marketplace.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/.claude-plugin/marketplace.json), which registers the HTTP endpoint and schema definitions for the LLM to invoke.
- **Codex** imports the skill as an npm package (`@gpt-image-2/style-library`) and calls **`generatePrompt()`** directly from `agents/skills/gpt-image-2-style-library/bin/generate.mjs`.
- Both platforms use identical request schemas (`templateId` + `customizations`) and receive standardized prompt strings generated from the master template catalog.
- The skill package at `agents/skills/gpt-image-2-style-library/` contains all runtime logic, making the integration portable across different LLM providers without code changes to the core library.

## Frequently Asked Questions

### What file contains the style definitions and templates?

All style categories, scenes, and prompt templates are defined in **[`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json)** at the repository root (lines 1‑190). This JSON file serves as the master catalog that both Claude Code and Codex integrations reference when generating prompts via the **`generatePrompt()`** function.

### Can I use the same templates for both Claude Code and Codex?

Yes. Both integrations read from the same **[`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json)** source, with Claude Code accessing it via the HTTP endpoint defined in [`.claude-plugin/marketplace.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/.claude-plugin/marketplace.json) and Codex importing the npm package that bundles the same JSON file. The **`generatePrompt()`** function in `agents/skills/gpt-image-2-style-library/bin/generate.mjs` processes templates identically regardless of the calling platform.

### How do I add custom templates to the library?

Add new template objects to **[`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json)** following the existing schema structure for categories and styles. After updating the JSON, restart the skill service if running via `agents/skills/gpt-image-2-style-library/bin/install.mjs` or reinstall the npm package for Codex. The changes become immediately available to both platforms since they reference the same underlying data file.

### What runtime is required to execute the skill locally?

The skill requires Node.js to execute the scripts in `agents/skills/gpt-image-2-style-library/bin/`. The **`generate.mjs`** module handles template processing while **`install.mjs`** initializes the HTTP server required for Claude Code integration. Codex users can alternatively import the package directly without running the HTTP server, provided the Node.js environment has access to the [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) file.