Skip to content

Commit 13f1647

Browse files
Release Gpt Image 2 SDK
Align with Input Contract, public API vocabulary, and endpoint updates.
1 parent 9208956 commit 13f1647

20 files changed

Lines changed: 108 additions & 119 deletions

File tree

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
</div>
2121
<br/>
2222

23-
The gpt image 2 api SDK packages JavaScript, Ruby, and Go clients for GPT Image 2 on RunAPI. Use this gpt image 2 api SDK for text-to-image, image-to-image, edit, and creative production workflows that need typed installs, JSON request bodies, task polling, and consistent RunAPI errors across services.
23+
The gpt image 2 api SDK packages JavaScript, Ruby, and Go clients for GPT Image 2 on RunAPI. Use this gpt image 2 api SDK for text-to-image, image editing, and creative production workflows that need typed installs, JSON request bodies, task polling, and consistent RunAPI errors across services.
2424

25-
GPT Image 2 belongs to the OpenAI catalog on RunAPI. The public model page is https://runapi.ai/models/gpt-image-2; variant pages below carry pricing, rate-limit, and commercial-usage details. The public `gpt-image-2-sdk` repository groups the JavaScript, Ruby, and Go packages for this model.
25+
GPT Image 2 belongs to the OpenAI catalog on RunAPI. The public model page is https://runapi.ai/models/gpt-image-2 and carries pricing, rate-limit, and commercial-usage details. The public `gpt-image-2-sdk` repository groups the JavaScript, Ruby, and Go packages for this model.
2626

2727
## Install
2828

@@ -73,13 +73,9 @@ For short scripts, use `run` with the same JSON body to create the task and wait
7373
- Provider comparison: https://runapi.ai/providers/openai
7474
- Full catalog: https://runapi.ai/models
7575

76-
## Pricing and variants
76+
## Pricing
7777

78-
Use the most specific gpt image 2 api variant page for pricing, rate limits, and commercial usage:
79-
- [GPT Image 2 text to image](https://runapi.ai/models/gpt-image-2/text-to-image)
80-
- [GPT Image 2 image to image](https://runapi.ai/models/gpt-image-2/image-to-image)
81-
82-
Default pricing link for the gpt image 2 api SDK: https://runapi.ai/models/gpt-image-2/text-to-image
78+
Use the GPT Image 2 model page for pricing, rate limits, and commercial usage: https://runapi.ai/models/gpt-image-2
8379

8480
## FAQ
8581

@@ -89,7 +85,7 @@ Install the model package for your language: `@runapi.ai/gpt-image-2`, `runapi-g
8985

9086
### Where should public links point?
9187

92-
Primary gpt image 2 api links point to https://runapi.ai/models/gpt-image-2. Pricing and usage-policy links point to variant pages such as https://runapi.ai/models/gpt-image-2/text-to-image. Provider comparisons point to https://runapi.ai/providers/openai, and broad browsing points to https://runapi.ai/models.
88+
Primary gpt image 2 api links point to https://runapi.ai/models/gpt-image-2. Provider comparisons point to https://runapi.ai/providers/openai, and broad browsing points to https://runapi.ai/models.
9389

9490
## License
9591

go/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GPT Image 2 API Go SDK for RunAPI
22

3-
The gpt image 2 api Go SDK is the language-specific package for GPT Image 2 on RunAPI. Use this gpt image 2 api package for text-to-image, image-to-image, edit, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Go.
3+
The gpt image 2 api Go SDK is the language-specific package for GPT Image 2 on RunAPI. Use this gpt image 2 api package for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Go.
44

55
This gpt image 2 api README is the Go package guide inside the public `gpt-image-2-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/gpt-image-2; for API reference, use https://runapi.ai/docs#gpt-image-2; for SDK docs, use https://runapi.ai/docs#sdk-gpt-image-2.
66

go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/runapi-ai/gpt-image-2-sdk/go
22

33
go 1.26
44

5-
require github.com/runapi-ai/core-sdk/go v0.2.4
5+
require github.com/runapi-ai/core-sdk/go v0.2.5

go/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github.com/runapi-ai/core-sdk/go v0.2.4 h1:ysUezd4PZZ3qzDxOZmzpJl7pgQqPrUklrw10ms7MKt0=
2-
github.com/runapi-ai/core-sdk/go v0.2.4/go.mod h1:e5uC8RF6BNkAj1WkOi+nD71mZL+cir+Ia97XUQj+5N0=
1+
github.com/runapi-ai/core-sdk/go v0.2.5 h1:fYs9hl4yAlQj6N6J638tnOUBN+aiALmRxH4t0LfBOGw=
2+
github.com/runapi-ai/core-sdk/go v0.2.5/go.mod h1:e5uC8RF6BNkAj1WkOi+nD71mZL+cir+Ia97XUQj+5N0=

go/gptimage2/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// client, err := gptimage2.NewClient(option.WithAPIKey("sk-your-api-key"))
44
// result, err := client.TextToImage.Run(ctx, gptimage2.TextToImageParams{
5-
// Model: "gpt-image-2-text-to-image", Prompt: "A beautiful landscape",
5+
// Model: "gpt-image-2", Prompt: "A beautiful landscape",
66
// })
77
package gptimage2
88

go/gptimage2/client_test.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ func (s *stubHTTPClient) Request(_ context.Context, method, path string, opts *c
2424
return s.response, nil
2525
}
2626

27-
func boolPtr(v bool) *bool { return &v }
28-
2927
func TestTextToImageCreate(t *testing.T) {
3028
stub := &stubHTTPClient{
3129
response: json.RawMessage(`{"id":"task_gen_123","status":"processing"}`),
3230
}
3331
client := NewClientWithHTTP(stub)
3432
resp, err := client.TextToImage.Create(context.Background(), TextToImageParams{
35-
Model: "gpt-image-2-text-to-image",
36-
Prompt: "a beautiful landscape",
37-
AspectRatio: "auto",
38-
NSFWChecker: boolPtr(false),
33+
Model: "gpt-image-2",
34+
Prompt: "a beautiful landscape",
35+
AspectRatio: "16:9",
36+
OutputResolution: "2k",
3937
})
4038
if err != nil {
4139
t.Fatal(err)
@@ -44,11 +42,11 @@ func TestTextToImageCreate(t *testing.T) {
4442
t.Fatalf("unexpected request: %s %s", stub.method, stub.path)
4543
}
4644
body := stub.body.(map[string]any)
47-
if body["model"] != "gpt-image-2-text-to-image" {
45+
if body["model"] != "gpt-image-2" {
4846
t.Fatalf("unexpected model: %v", body["model"])
4947
}
50-
if body["nsfw_checker"] != false {
51-
t.Fatalf("unexpected nsfw_checker: %v", body["nsfw_checker"])
48+
if body["output_resolution"] != "2k" {
49+
t.Fatalf("unexpected output_resolution: %v", body["output_resolution"])
5250
}
5351
if resp.ID != "task_gen_123" {
5452
t.Fatalf("unexpected task ID: %v", resp.ID)
@@ -78,10 +76,11 @@ func TestEditImageCreate(t *testing.T) {
7876
}
7977
client := NewClientWithHTTP(stub)
8078
resp, err := client.EditImage.Create(context.Background(), EditImageParams{
81-
Model: "gpt-image-2-image-to-image",
82-
Prompt: "transform into oil painting",
83-
InputURLs: []string{"https://example.com/photo.jpg"},
84-
NSFWChecker: boolPtr(false),
79+
Model: "gpt-image-2",
80+
Prompt: "transform into oil painting",
81+
SourceImageURLs: []string{"https://cdn.runapi.ai/public/samples/photo.jpg"},
82+
AspectRatio: "16:9",
83+
OutputResolution: "2k",
8584
})
8685
if err != nil {
8786
t.Fatal(err)
@@ -90,11 +89,11 @@ func TestEditImageCreate(t *testing.T) {
9089
t.Fatalf("unexpected request: %s %s", stub.method, stub.path)
9190
}
9291
body := stub.body.(map[string]any)
93-
if body["model"] != "gpt-image-2-image-to-image" {
92+
if body["model"] != "gpt-image-2" {
9493
t.Fatalf("unexpected model: %v", body["model"])
9594
}
96-
if body["nsfw_checker"] != false {
97-
t.Fatalf("unexpected nsfw_checker: %v", body["nsfw_checker"])
95+
if body["output_resolution"] != "2k" {
96+
t.Fatalf("unexpected output_resolution: %v", body["output_resolution"])
9897
}
9998
if resp.ID != "task_edit_123" {
10099
t.Fatalf("unexpected task ID: %v", resp.ID)

go/gptimage2/types.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ package gptimage2
33
type TaskStatus string
44

55
type TextToImageParams struct {
6-
Model string `json:"model" help:"required; gpt-image-2-text-to-image"`
7-
Prompt string `json:"prompt" help:"required; text description of the desired image"`
8-
AspectRatio string `json:"aspect_ratio,omitempty" help:"optional; auto, 1:1, 5:4, 9:16, 21:9, 16:9, 4:3, 3:2, 4:5, 3:4, or 2:3"`
9-
NSFWChecker *bool `json:"nsfw_checker,omitempty" help:"optional; content filter toggle"`
10-
CallbackURL string `json:"callback_url,omitempty" help:"optional; webhook URL"`
6+
Model string `json:"model" help:"required; model slug"`
7+
Prompt string `json:"prompt" help:"required; text description of the desired image"`
8+
AspectRatio string `json:"aspect_ratio,omitempty" help:"optional; output aspect ratio"`
9+
OutputResolution string `json:"output_resolution,omitempty" help:"optional; output resolution"`
10+
CallbackURL string `json:"callback_url,omitempty" help:"optional; webhook URL"`
1111
}
1212

1313
type EditImageParams struct {
14-
Model string `json:"model" help:"required; gpt-image-2-image-to-image"`
15-
Prompt string `json:"prompt" help:"required; text description of the desired edit"`
16-
InputURLs []string `json:"input_urls" help:"required; 1-16 input image URLs"`
17-
AspectRatio string `json:"aspect_ratio,omitempty" help:"optional; auto, 1:1, 5:4, 9:16, 21:9, 16:9, 4:3, 3:2, 4:5, 3:4, or 2:3"`
18-
NSFWChecker *bool `json:"nsfw_checker,omitempty" help:"optional; content filter toggle"`
19-
CallbackURL string `json:"callback_url,omitempty" help:"optional; webhook URL"`
14+
Model string `json:"model" help:"required; model slug"`
15+
Prompt string `json:"prompt" help:"required; text description of the desired edit"`
16+
SourceImageURLs []string `json:"source_image_urls" help:"required; 1-16 source image URLs"`
17+
AspectRatio string `json:"aspect_ratio,omitempty" help:"optional; output aspect ratio"`
18+
OutputResolution string `json:"output_resolution,omitempty" help:"optional; output resolution"`
19+
CallbackURL string `json:"callback_url,omitempty" help:"optional; webhook URL"`
2020
}
2121

2222
type AsyncTaskResponse struct {

js/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GPT Image 2 API JavaScript SDK for RunAPI
22

3-
The gpt image 2 api JavaScript SDK is the language-specific package for GPT Image 2 on RunAPI. Use this gpt image 2 api package for text-to-image, image-to-image, edit, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
3+
The gpt image 2 api JavaScript SDK is the language-specific package for GPT Image 2 on RunAPI. Use this gpt image 2 api package for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
44

55
This gpt image 2 api README is the JavaScript package guide inside the public `gpt-image-2-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/gpt-image-2; for API reference, use https://runapi.ai/docs#gpt-image-2; for SDK docs, use https://runapi.ai/docs#sdk-gpt-image-2.
66

js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@runapi.ai/gpt-image-2",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"description": "RunAPI GPT Image 2 SDK for JavaScript, Ruby, and Go",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",
@@ -27,7 +27,7 @@
2727
"clean": "rm -rf dist"
2828
},
2929
"dependencies": {
30-
"@runapi.ai/core": "^0.2.4"
30+
"@runapi.ai/core": "^0.2.5"
3131
},
3232
"devDependencies": {
3333
"@types/node": "^20.0.0",

js/skills/gpt-image-2/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</div>
2222
<br/>
2323

24-
Generate and edit images with GPT Image 2 text-to-image and image-to-image. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate GPT Image 2 through RunAPI.
24+
Generate and edit images with GPT Image 2. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate GPT Image 2 through RunAPI.
2525

2626
The canonical agent file is `skills/gpt-image-2/SKILL.md`.
2727

@@ -51,7 +51,7 @@ import { GptImage2Client } from '@runapi.ai/gpt-image-2';
5151

5252
const client = new GptImage2Client();
5353
const result = await client.textToImage.run({
54-
model: 'gpt-image-2-text-to-image',
54+
model: 'gpt-image-2',
5555
prompt: 'A futuristic cityscape at night',
5656
});
5757
```
@@ -62,20 +62,19 @@ const result = await client.textToImage.run({
6262
- Product docs: https://runapi.ai/docs#gpt-image-2
6363
- SDK docs: https://runapi.ai/docs#sdk-gpt-image-2
6464
- SDK repository: https://github.com/runapi-ai/gpt-image-2-sdk
65-
- Pricing and rate limits: https://runapi.ai/models/gpt-image-2/text-to-image
65+
- Pricing and rate limits: https://runapi.ai/models/gpt-image-2
6666
- Provider comparison: https://runapi.ai/providers/openai
6767
- Browse all RunAPI models and skills: https://runapi.ai/models
6868

69-
## Variants
69+
## Model
7070

71-
- [GPT Image 2 text to image](https://runapi.ai/models/gpt-image-2/text-to-image)
72-
- [GPT Image 2 image to image](https://runapi.ai/models/gpt-image-2/image-to-image)
71+
- [GPT Image 2](https://runapi.ai/models/gpt-image-2)
7372

7473
## Agent rules
7574

7675
- Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
7776
- Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
78-
- For gpt image 2 api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
77+
- For gpt image 2 api pricing, rate-limit, and commercial-usage answers, link to the model page rather than the repository README.
7978

8079
## License
8180

0 commit comments

Comments
 (0)