Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions openai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1075,11 +1075,13 @@ Explore the supported endpoints and integration guides for OpenAI generation.

| API | Path | Integration Guidance |
| ---- | ---- | ------------ |
| [OpenAI Chat Completions API](https://platform.acedata.cloud/documents/1bcf3bba-102b-495d-9bba-47cd96717e45) | `/openai/chat/completions` | [OpenAI Chat Completion API Integration Guide](https://platform.acedata.cloud/documents/fc571e00-464f-429e-b920-8896c906c2b9) |
| [OpenAI Images Generations API](https://platform.acedata.cloud/documents/fd932485-90c7-45d6-8394-1e14b6f07b2b) | `/openai/images/generations` | [OpenAI Images Generations API Integration Guide](https://platform.acedata.cloud/documents/22fce352-b71e-4177-991f-2216841f35e2) |
| [OpenAI Responses API](https://platform.acedata.cloud/documents/81e285a6-d010-4a2d-a3a8-ca113d4ef82a) | `/openai/responses` | [OpenAI Responses API Integration Guide](https://platform.acedata.cloud/documents/c1da5338-9fff-4390-bbdc-29713893c07a) |
| [$t(document_title_openai_embeddings_api)](https://platform.acedata.cloud/documents/0f2e63fa-5890-4bdd-84f0-1706b5c9a387) | `/openai/embeddings` | [](https://platform.acedata.cloud/documents/) |
| [OpenAI Images Edits API](https://platform.acedata.cloud/documents/251f1efa-aaa6-462e-8af4-66854b1bc94d) | `/openai/images/edits` | [OpenAI Images Edits API Integration Guide](https://platform.acedata.cloud/documents/932e4b89-2cbb-4cb9-8f85-c9af256bfe69) |
| [OpenAI Chat Completions API](https://platform.acedata.cloud/documents/1bcf3bba-102b-495d-9bba-47cd96717e45) | `/openai/chat/completions` | [OpenAI Chat Completion API Integration Guide](docs/openai_chat_completion_api_integration_guide.md) |
| [OpenAI Embeddings API](https://platform.acedata.cloud/documents/0f2e63fa-5890-4bdd-84f0-1706b5c9a387) | `/openai/embeddings` | [OpenAI Embeddings API Integration Guide](docs/openai_embeddings_api_integration_guide.md) |
| [OpenAI Images Generations API](https://platform.acedata.cloud/documents/fd932485-90c7-45d6-8394-1e14b6f07b2b) | `/openai/images/generations` | [OpenAI Images Generations API Integration Guide](docs/openai_images_generations_api_integration_guide.md) |
| OpenAI Models API | `/openai/models` | — |
| [OpenAI Responses API](https://platform.acedata.cloud/documents/81e285a6-d010-4a2d-a3a8-ca113d4ef82a) | `/openai/responses` | [OpenAI Responses API Integration Guide](docs/openai_responses_api_integration_guide.md) |
| [OpenAI Images Edits API](https://platform.acedata.cloud/documents/251f1efa-aaa6-462e-8af4-66854b1bc94d) | `/openai/images/edits` | [OpenAI Images Edits API Integration Guide](docs/openai_images_edits_api_integration_guide.md) |
| OpenAI Tasks API | `/openai/tasks` | [OpenAI Tasks API Integration Guide](docs/openai_tasks_api_integration_guide.md) |

## Related Resources

Expand Down
26 changes: 14 additions & 12 deletions openai/docs/openai_chat_completion_api_integration_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ This document mainly introduces the usage process of the OpenAI Chat Completion

## Application Process

To use the OpenAI Chat Completion API, you can first visit the [OpenAI Chat Completion API](https://platform.acedata.cloud/documents/1bcf3bba-102b-495d-9bba-47cd96717e45) page and click the "Acquire" button to obtain the credentials needed for the request:
To use OpenAI Chat Completion API, first open the [Ace Data Cloud Console](https://platform.acedata.cloud/console/applications) and copy your API Token.

![](https://cdn.acedata.cloud/nyq0xz.png)
![](https://cdn.acedata.cloud/5hmkdg.jpg)

If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page.
If you are not logged in, you will be redirected to sign in and brought back to this page automatically.

When applying for the first time, there will be a free quota available for you to use the API for free.
**A single API Token works across every service on the platform — no need to subscribe per service.** New accounts receive free starter credit; when it runs low you can top up your shared balance in the [console](https://platform.acedata.cloud/console/coin).

> 📘 Full documentation: [OpenAI Chat Completion API →](https://platform.acedata.cloud/documents/openai-chat-completions)

## Basic Usage

Expand Down Expand Up @@ -40,7 +42,7 @@ After the call, we find that the return result is as follows:
"id": "chatcmpl-Cmd6uwSxN75F4PAdQSFEO8f2QPs4E",
"object": "chat.completion",
"created": 1765706120,
"model": "gpt-5.4",
"model": "gpt-5.2",
"choices": [
{
"index": 0,
Expand Down Expand Up @@ -517,11 +519,11 @@ Example result:

When calling the API, if an error occurs, the API will return the corresponding error code and message. For example:

- `400 token_mismatched`: Bad request, possibly due to missing or invalid parameters.
- `400 api_not_implemented`: Bad request, possibly due to missing or invalid parameters.
- `401 invalid_token`: Unauthorized, invalid or missing authorization token.
- `429 too_many_requests`: Too many requests, you have exceeded the rate limit.
- `500 api_error`: Internal server error, something went wrong on the server.
- `400 token_mismatched`:错误请求,可能是由于缺少或无效的参数。
- `400 api_not_implemented`:错误请求,可能是由于缺少或无效的参数。
- `401 invalid_token`:未授权,授权令牌无效或缺失。
- `429 too_many_requests`:请求过多,您已超出速率限制。
- `500 api_error`:内部服务器错误,服务器出现问题。

### Error Response Example

Expand All @@ -530,12 +532,12 @@ When calling the API, if an error occurs, the API will return the corresponding
"success": false,
"error": {
"code": "api_error",
"message": "fetch failed"
"message": "获取失败"
},
"trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}
```

## Conclusion

Through this document, you have learned how to easily implement the conversational features of the official OpenAI ChatGPT using the OpenAI Chat Completion API. We hope this document can help you better connect and use this API. If you have any questions, please feel free to contact our technical support team.
Through this document, you have learned how to easily implement the conversational features of the official OpenAI ChatGPT using the OpenAI Chat Completion API. We hope this document can help you better connect and use this API. If you have any questions, please feel free to contact our technical support team.
112 changes: 66 additions & 46 deletions openai/docs/openai_chat_completions_4o_image_api_integration_guide.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
# OpenAI Chat Completion 4o Image API Application and Usage

OpenAI ChatGPT is a very powerful AI dialogue system that can generate smooth and natural responses in just a few seconds by inputting prompts. ChatGPT stands out in the industry with its excellent language understanding and generation capabilities, and today, ChatGPT has been widely applied in various industries and fields, with its influence becoming increasingly significant. Whether for daily conversations, creative writing, or professional consulting and coding, ChatGPT can provide astonishing intelligent assistance, greatly enhancing human work efficiency and creativity.
OpenAI ChatGPT is a powerful AI conversational system that can generate smooth and natural replies within seconds based on input prompts. ChatGPT stands out in the industry for its excellent language understanding and generation capabilities. Today, ChatGPT is widely applied across various industries and fields, with its influence becoming increasingly significant. Whether for daily conversations, creative writing, professional consulting, or code programming, ChatGPT provides impressive intelligent assistance, greatly enhancing human work efficiency and creativity.

This document mainly introduces the usage process of the OpenAI Chat Completion 4o Image API, which allows us to easily utilize the official OpenAI ChatGPT's multimodal dialogue capabilities.
This document mainly introduces the usage process of the OpenAI Chat Completion 4o Image API, which allows us to easily utilize the official OpenAI ChatGPTs multimodal conversational features.

## Application Process

To use the OpenAI Chat Completion 4o Image API, you can first visit the [OpenAI Chat Completion 4o Image API](https://platform.acedata.cloud/documents/1bcf3bba-102b-495d-9bba-47cd96717e45) page and click the "Acquire" button to obtain the credentials needed for the request:
To use OpenAI Chat Completion 4o Image API, first open the [Ace Data Cloud Console](https://platform.acedata.cloud/console/applications) and copy your API Token.

![](https://cdn.acedata.cloud/nyq0xz.png)
![](https://cdn.acedata.cloud/5hmkdg.jpg)

If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page.
If you are not logged in, you will be redirected to sign in and brought back to this page automatically.

There is a free quota available for first-time applicants, allowing you to use the API for free.
**A single API Token works across every service on the platform — no need to subscribe per service.** New accounts receive free starter credit; when it runs low you can top up your shared balance in the [console](https://platform.acedata.cloud/console/coin).

> 📘 Full documentation: [OpenAI Chat Completion 4o Image API →](https://platform.acedata.cloud/documents/openai-chat-completions)

## GPT-4o Drawing Model

### Generate Images Based on Reference Images
### Generating Images Based on Reference Images

Below is an example of generating a custom style image based on a reference image. First, let's look at the input image, as shown below:
Below is an example of generating a custom style image based on a given picture. First, let's look at the input image:

![](https://cdn.acedata.cloud/qzx2z1.png)

The reference image is a real person's picture, and we can change its style, for example, transforming it into an anime-style image. The specific request example is as follows:
The reference image is a photo of a real person. We can transform its style, for example, turning it into an anime-style image. The specific request example is:

```json
{
Expand All @@ -33,7 +35,7 @@ The reference image is a real person's picture, and we can change its style, for
"content": [
{
"type": "text",
"text": "Generate an anime-style image with a hat"
"text": "生成动漫风格的图片,并且带上个帽子"
},
{
"type": "image_url",
Expand All @@ -52,35 +54,41 @@ Sample result:

```json
{
"id": "chatcmpl-89DPQxbLuyRNzH5YLCPYM5WElV3dm",
"object": "chat.completion",
"created": 1781020664,
"model": "gpt-4o-image",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "> ❇️ Keywords: https://file.onechats.ai/tem/f7b8024b6f430a0a9d20174bcec1ad3a.png Generate an anime-style image with a hat\n\n> ✨ Sora is drawing the image...\n\n> 🏃 Progress: 8.4%\n\n> 🏃 Progress: 17.5%\n\n> 🏃 Progress: 25.9%\n\n> 🏃 Progress: 34.3%\n\n> 🏃 Progress: 43.4%\n\n> 🏃 Progress: 51.8%\n\n> 🏃 Progress: 60.9%\n\n> 🏃 Progress: 71.4%\n\n> 🏃 Progress: 76.3%\n\n> 🏃 Progress: 80.4%\n\n> 🏃 Progress: 83.8%\n\n> 🏃 Progress: 86.6%\n\n> 🏃 Progress: 88.9%\n\n> 🏃 Progress: 90.8%\n\n> 🏃 Progress: 92.4%\n\n> ✅ Image drawing successful, please check~~~\n\n![](https://file.onechats.ai/tem/4abe605b362a9a59028bf7fafa5f2aff.png)\n\n"
"content": "\n\n> 🎨 生成中...\n\n![https://pro.filesystem.site/cdn/20260609/0f7b6cf1b14843b1bab8e261fe5765b3.png](https://pro.filesystem.site/cdn/20260609/0f7b6cf1b14843b1bab8e261fe5765b3.png)\n\n[点击下载](https://pro.filesystem.site/cdn/download/20260609/0f7b6cf1b14843b1bab8e261fe5765b3.png)"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"created": 1745152859,
"id": "chatcmpl-7c43d1dd-17e3-4513-9aec-899b21be3c2a",
"model": "gpt-4o-image",
"object": "chat.completion.chunk",
"usage": {
"prompt_tokens": 68,
"completion_tokens": 19,
"total_tokens": 87
"prompt_tokens": 100,
"completion_tokens": 122,
"total_tokens": 222,
"prompt_tokens_details": {
"text_tokens": 93,
"cached_tokens_details": {}
},
"completion_tokens_details": {}
}
}
```

In which the `choices` inside the `message` is the complete dialogue result, and the image result is also included in the dialogue result. It can be seen that the generated image is indeed in anime style, as shown in the following image:
The `message.content` inside `choices` contains the complete generated conversation result, with the image embedded in Markdown format (the image link is a temporary address, please download and save it promptly). The generated image is indeed in anime style, as shown below:

<p><img src="https://cdn.acedata.cloud/qmr391.jpg" width="400" class="m-auto"></p>

### Pure Text Image Generation
### Text-Only Image Generation

We can generate an image through a prompt and return it to us in a conversational format. Below, we take `Create an image of a sunset in a futuristic city` as an example, with the specific example as follows:
We can generate an image based on a prompt and receive the result in a conversational format. Below is an example with the prompt `Create an image of a futuristic city at sunset`:

```json
{
Expand All @@ -91,7 +99,7 @@ We can generate an image through a prompt and return it to us in a conversationa
"content": [
{
"type": "text",
"text": "Create an image of a sunset in a futuristic city"
"text": "创建一张未来城市日落的图片"
}
]
}
Expand All @@ -104,41 +112,47 @@ Sample result:

```json
{
"id": "chatcmpl-89DqkpQoPGkQqJ6kPKMKWejjLXVxQ",
"object": "chat.completion",
"created": 1781020587,
"model": "gpt-4o-image",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "> ❇️ Keywords: Create an image of a sunset in a futuristic city\n\n> ✨ Sora is drawing the image...\n\n> 🏃 Progress: 9.8%\n\n> 🏃 Progress: 19.6%\n\n> 🏃 Progress: 30.1%\n\n> 🏃 Progress: 39.9%\n\n> 🏃 Progress: 50.4%\n\n> 🏃 Progress: 60.2%\n\n> 🏃 Progress: 69.3%\n\n> ✅ Image drawing successful, please check~~~\n\n![](https://file.onechats.ai/tem/4ab6f3cd886aaa6fd575dd37327fae59.png)\n\n"
"content": "\n\n> 🎨 生成中...\n\n![https://pro.filesystem.site/cdn/20260609/ed2cca68732540fc99162ddc10ddc153.png](https://pro.filesystem.site/cdn/20260609/ed2cca68732540fc99162ddc10ddc153.png)\n\n[点击下载](https://pro.filesystem.site/cdn/download/20260609/ed2cca68732540fc99162ddc10ddc153.png)"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"created": 1745153373,
"id": "chatcmpl-29ed630a-c8fc-4a8a-a8e0-737fcc515192",
"model": "gpt-4o-image",
"object": "chat.completion.chunk",
"usage": {
"prompt_tokens": 32,
"completion_tokens": 11,
"total_tokens": 43
"prompt_tokens": 17,
"completion_tokens": 104,
"total_tokens": 121,
"prompt_tokens_details": {
"text_tokens": 10,
"cached_tokens_details": {}
},
"completion_tokens_details": {}
}
}
```

It can be seen that the result meets the prompt, as shown below:
The result matches the prompt, as shown below:

<p><img src="https://cdn.acedata.cloud/q502uk.jpg" width="400" class="m-auto"></p>

### Generate One Image from Multiple Images
### Multiple Images to One Image

We can also use multiple reference images to generate one image. For example, using an image of a handsome man and a coffee image, we can generate an image of a handsome man drinking coffee. Below are the specific reference images:
We can also use multiple reference images to generate a single image. For example, using a photo of a handsome man and a coffee image, we can generate an image of the man drinking coffee. Below are the reference images:

<p><img src="https://cdn.acedata.cloud/pqquv3.jpg" width="400" class="m-auto"></p>

<p><img src="https://cdn.acedata.cloud/h8j2i0.jpg" width="400" class="m-auto"></p>

Below we take `generate a boy holding a coffee and about to drink it` as an example, here are the specific examples:
Here is an example prompt: `Generate an image of a man holding coffee and about to drink it`:

```json
{
Expand All @@ -149,7 +163,7 @@ Below we take `generate a boy holding a coffee and about to drink it` as an exam
"content": [
{
"type": "text",
"text": "generate a boy holding a coffee and about to drink it"
"text": "生成男生举着咖啡,并且马上要喝的样子"
},
{
"type": "image_url",
Expand All @@ -174,29 +188,35 @@ Sample result:

```json
{
"id": "chatcmpl-89DnHbbzOIQvU1VzJrNjzMU8BRUgG",
"object": "chat.completion",
"created": 1781021018,
"model": "gpt-4o-image",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "> ❇️ Keywords: https://file.onechats.ai/tem/b5e2049e82ef071a804d6769e580b702.png https://file.onechats.ai/tem/78e9aa8a0dbd529f3904a6629329ebbe.png generate a boy holding a coffee and about to drink it\n\n> ✨ Sora is drawing the image...\n\n> 🏃 Progress: 11.2%\n\n> 🏃 Progress: 25.9%\n\n> 🏃 Progress: 39.9%\n\n> 🏃 Progress: 47.6%\n\n> 🏃 Progress: 55.3%\n\n> 🏃 Progress: 73.3%\n\n> 🏃 Progress: 78.0%\n\n> 🏃 Progress: 81.8%\n\n> ✅ Image drawing successful, please check~~~\n\n![](https://file.onechats.ai/tem/6aa9ad6c26b9d4500ea84ea9f56e331b.png)\n\n"
"content": "\n\n> 🎨 生成中...\n\n![https://pro.filesystem.site/cdn/20260610/f1d9ddee3c304230a9f92929f04b95be.png](https://pro.filesystem.site/cdn/20260610/f1d9ddee3c304230a9f92929f04b95be.png)\n\n[点击下载](https://pro.filesystem.site/cdn/download/20260610/f1d9ddee3c304230a9f92929f04b95be.png)"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"created": 1745154125,
"id": "chatcmpl-d6e5fc71-4e33-4ad6-b259-357241d7c1ab",
"model": "gpt-4o-image",
"object": "chat.completion.chunk",
"usage": {
"prompt_tokens": 106,
"completion_tokens": 12,
"total_tokens": 118
"prompt_tokens": 193,
"completion_tokens": 116,
"total_tokens": 309,
"prompt_tokens_details": {
"text_tokens": 186,
"cached_tokens_details": {}
},
"completion_tokens_details": {}
}
}
```

As you can see, the generated result is indeed a combination of the two images, here is the specific result:
The generated result indeed combines the two images, as shown below:

<p><img src="https://cdn.acedata.cloud/89vnpx.jpg" width="400" class="m-auto"></p>

Expand All @@ -212,7 +232,7 @@ When calling the API, if an error occurs, the API will return the corresponding

### Error Response Example

```json
```
{
"success": false,
"error": {
Expand All @@ -225,4 +245,4 @@ When calling the API, if an error occurs, the API will return the corresponding

## Conclusion

Through this document, you have learned how to easily implement the official OpenAI ChatGPT's multimodal image processing capabilities using the OpenAI Chat Completion 4o Image API. We hope this document helps you better integrate and use this API. If you have any questions, please feel free to contact our technical support team.
Through this document, you have learned how to easily implement the official OpenAI ChatGPT multimodal image processing features using the OpenAI Chat Completion 4o Image API. We hope this document helps you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.
Loading