# GPT Image 2 API Format (WanJie MaaS) ## Endpoint ``` POST https://maas-openapi.wanjiedata.com/api/v1/images/generations ``` ## Request Format ```json { "model": "GPT Image 2", "prompt": "Your prompt text here...", "n": 1, "size": "1024x1024" } ``` ## Response Format ```json { "created": 1234567890, "data": [ { "b64_json": "base64_encoded_image_data..." } ], "usage": { "total_tokens": 210, "input_tokens": 14, "output_tokens": 196 } } ``` ## Key Differences from Gemini Endpoint | Aspect | GPT Image 2 | Gemini | |--------|-------------|--------| | Endpoint | `/api/v1/images/generations` | `/api/v1beta/models/{MODEL}:generateContent` | | Request format | `{model, prompt, n, size}` | `{contents, generationConfig}` | | Response format | `{data: [{b64_json}]}` | `{candidates: [{content: {parts: [{inlineData: {data}}]}}]}` | | Image extraction | `data[0].b64_json` | `candidates[0].content.parts[0].inlineData.data` | | Price | ¥0.14/image | Varies | ## curl Example ```bash curl -X POST 'https://maas-openapi.wanjiedata.com/api/v1/images/generations' \ -H "Authorization: Bearer $WANJIE_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "model": "GPT Image 2", "prompt": "A cute orange cat", "n": 1, "size": "1024x1024" }' ``` ## Model Listing Endpoint ```bash curl https://maas-openapi.wanjiedata.com/api/v1/models \ -H "Authorization: Bearer $WANJIE_API_KEY" ``` Returns all available models including "GPT Image 2".