Skip to main content
This page documents the legacy Sora Image integration for existing projects that still need troubleshooting, migration, or compatibility maintenance. For new image-generation integrations, start with GPT-Image-2 and the Image Generation API Guide. Legacy-route availability, pricing, and parameter support are subject to the current console configuration.

Prerequisites

1

Get API Key

Log in to laozhang.ai console to obtain your API key
2

Configure Billing Mode

Edit token settings and choose one of the following billing modes. Actual billing rules are determined by the current console configuration:
  • Volume Priority (Recommended): Uses balance billing first, automatically switches when balance is insufficient. Suitable for most users
  • Pay-per-call: Direct deduction for each call. Suitable for strict budget control scenarios
The two modes differ by billing path: volume priority uses balance first, while pay-per-call deducts per request. Always confirm the current price in the console.
Token Settings
If billing mode is not configured, API calls will fail. You must complete this configuration first!

Model Overview

The legacy Sora Image integration returns image URLs through the chat completions interface. It is intended for projects that still maintain the legacy model IDs. New projects should evaluate the currently recommended image-generation APIs first, and availability and billing are determined by the console.
Billing is console-driven
The legacy route may continue to serve existing integrations, but do not hardcode per-image prices in code or public docs. Confirm token group, billing mode, and model status before use.

Interface Capabilities

  • Legacy model ID compatibility: For existing projects that still use sora_image or gpt-4o-image
  • Chat completions interface: Submit prompts through /v1/chat/completions and parse the returned image URL
  • Aspect-ratio parameters: Supports 2:3, 3:2, and 1:1
  • URL return: Responses include downloadable image links
  • Console-controlled status: Availability, pricing, and parameter support may change with route configuration

Model Information

Migration guidance
If you are building a new image-generation integration, read the Image Generation API Guide first. If you are maintaining legacy-route code, confirm that your current token group still supports the model ID.

🚀 Quick Start

Basic Example

Batch Generation Example

📐 Aspect Ratio Guide

Sora Image supports three preset ratios, specified by adding ratio markers at the end of prompts:

Size Usage Examples

🎯 Best Practices

1. Prompt Optimization

2. Error Handling

3. Result Saving

💡 Advanced Tips

1. Stylized Generation

2. Scene Templates

⚠️ Important Notes

  1. Model Selection:
    • sora_image: Legacy Sora Image route
    • gpt-4o-image: Legacy image-generation model ID
    • Confirm availability, billing mode, and current price in the console
  2. Ratio Markers:
    • Add ratio marker at end of prompt: 【2:3】, 【3:2】, or 【1:1】
    • Markers must use Chinese brackets 【】
    • Without marker, uses default ratio
  3. URL Extraction:
    • Response contains image URLs in Markdown format
    • Use regex to extract: !\[.*?\]\((https?://[^)]+)\)
    • Download images promptly after generation
  4. Prompt Language:
    • Chinese and English prompts are supported
    • Validate important production prompts with a fixed test set
    • Keep prompts concise and explicit for more stable outputs

🔍 FAQ

Q: How is Sora Image different from GPT-Image-1?

A:
  • Sora Image: Legacy route through the chat completions interface
  • GPT-Image-1: Current image-generation model family with its own billing model
  • Confirm current pricing and availability in the console before choosing a route

Q: Can I use English prompts?

A: Yes. Chinese and English prompts are supported, but production prompts should be validated with your own test set.

Q: How to specify aspect ratio?

A: Add ratio marker at end of prompt: Your prompt【2:3】

Q: Are generated images downloadable?

A: Yes, extract URLs from response and download immediately. URLs may expire after some time.

Q: What’s the maximum prompt length?

A: No strict limit, but recommended to keep prompts concise and descriptive for best results.
🎨 Pro Tip: Add detailed descriptions, artistic styles, and lighting conditions to your prompts for better results. The model excels at understanding natural language!