# LaoZhang API: English

> 老张API（LaoZhang API）是新加坡公司 YingTu Technology Pte. Ltd. 自 2025 年起运营的 AI API 网关：一个 API Key 调用 Google Nano Banana、OpenAI GPT Image、xAI Grok Imagine 等图像模型和多家厂商的文本、视频模型，预付余额按用量或按次计费，提供调用日志、服务状态页和双语开发文档。

## English

### Home

#### Get started

- [LaoZhang API docs: start calling AI models](https://docs.laozhang.ai/en/index.md): Get the LaoZhang API base URL, send a first request in three steps, and find guides for text, image, and video APIs, model prices, and billing.
- [About LaoZhang API: operator, models, billing](https://docs.laozhang.ai/en/about.md): Who operates LaoZhang API and since when, where its image models come from, and how routes, payment, refunds, data handling, status, and support work.
- [Connect your application to LaoZhang API](https://docs.laozhang.ai/en/api-manual.md): Set up a LaoZhang API key, send OpenAI, Anthropic, and Gemini requests, generate or edit images, and move an existing OpenAI app, with working examples.
- [Billing, token groups, and invoices](https://docs.laozhang.ai/en/pricing.md): How LaoZhang API charges usage-based and per-call models, how token billing modes and group multipliers work, and how to top up or get an invoice.
- [Balance API: /api/user/self with AccessToken](https://docs.laozhang.ai/en/api-capabilities/balance-query.md): Monitor your LaoZhang API balance: get a system AccessToken, call /api/user/self, read the quota fields, and convert quota to US dollars for alerts.
- [Official AI model API docs by vendor](https://docs.laozhang.ai/en/resources.md): Official API docs for OpenAI, Anthropic, Google Gemini, Alibaba Cloud, ByteDance, xAI, and Black Forest Labs, each mapped to its LaoZhang API guide.

#### Image Generation & Editing APIs

- [Image generation APIs: models and pricing](https://docs.laozhang.ai/en/api-capabilities/image-generation-guide.md): Compare LaoZhang API image models by model ID, endpoint, editing support, output size, billing, and price, then open the right integration guide.
- [Image API billing and failure rules](https://docs.laozhang.ai/en/api-capabilities/image-billing-and-failures.md): When Nano Banana, GPT Image, and Grok Imagine requests are charged on LaoZhang API: errors, moderation, HTTP 200 with no image, timeouts, retries, concurrency.
- [Grok Imagine API: generate and edit images](https://docs.laozhang.ai/en/api-capabilities/grok-imagine-image.md): Generate 1K or 2K images with grok-imagine-image-2.0 and edit with up to three reference images through LaoZhang API, billed per returned image.
- [Seedream API: generate and edit images](https://docs.laozhang.ai/en/api-capabilities/seedream-image.md): Generate and edit images with Seedream 5.0 Flash, 5.0 Pro, 5.0, 4.5, or 4.0 through LaoZhang API, with edits from up to 10 references and transparent layers.

##### GPT Image

- [GPT Image 2.5 API: generate and edit images](https://docs.laozhang.ai/en/api-capabilities/gpt-image-2-5.md): Generate and edit images with GPT Image 2.5 Flare and Sunburst through official forwarding, per-call VIP models, or the web route.
- [GPT Image 2 API: groups, billing, and editing](https://docs.laozhang.ai/en/api-capabilities/gpt-image-2.md): Keep gpt-image-2 and gpt-image-2-vip integrations running: choose the token group, understand per-call and token billing, and generate or edit images.

##### Nano Banana

- [Nano Banana API overview: models and pricing](https://docs.laozhang.ai/en/api-capabilities/nano-banana-image.md): Compare the five Nano Banana models on LaoZhang API by price, output size, and ratios, and call them through OpenAI-compatible or Gemini-native requests.
- [Nano Banana API: image editing (Standard)](https://docs.laozhang.ai/en/api-capabilities/nano-banana-image-edit.md): Edit and combine images with gemini-2.5-flash-image on LaoZhang API, which still serves it after Google's shutdown date, and move to Nano Banana 2.
- [Nano Banana 2 Lite API: generate and edit](https://docs.laozhang.ai/en/api-capabilities/nano-banana-2-lite-api.md): Call gemini-3.1-flash-lite-image on LaoZhang API for low-cost 1K image generation and editing, with 10 aspect ratios, local image input, and saved output.
- [Nano Banana 2.1 API: generate and edit images](https://docs.laozhang.ai/en/api-capabilities/nano-banana-2-1-image.md): Generate and edit 1K to 4K images with gemini-nano-banana-2.1 on LaoZhang API at 0.045 USD per call: 14 aspect ratios, 14 references, and runnable code.
- [Nano Banana 2 API: generate and edit images](https://docs.laozhang.ai/en/api-capabilities/nano-banana2-image.md): Generate and edit images with gemini-3.1-flash-image on LaoZhang API: 512px to 4K output, 14 aspect ratios, up to 14 references, and runnable code.
- [Nano Banana Pro API: image generation](https://docs.laozhang.ai/en/api-capabilities/nano-banana-pro-image.md): Generate images with gemini-3-pro-image on LaoZhang API: 1K to 4K output, 10 aspect ratios, Google Search grounding, and runnable Python and cURL code.
- [Nano Banana Pro API: image editing](https://docs.laozhang.ai/en/api-capabilities/nano-banana-pro-image-edit.md): Edit and combine images with gemini-3-pro-image on LaoZhang API: up to 14 reference images, 1K to 4K output, public URL input, and runnable code.

##### FLUX.2

- [FLUX.2 API: image generation](https://docs.laozhang.ai/en/api-capabilities/flux-image-generation.md): Generate images with flux-2-pro, flux-2-flex, or flux-2-max on LaoZhang API through one JSON endpoint, set the output size, and save the result in time.
- [FLUX.2 API: image editing](https://docs.laozhang.ai/en/api-capabilities/flux-image-edit.md): Edit images with flux-2-pro, flux-2-flex, or flux-2-max on LaoZhang API: send JSON with up to eight reference images and save the result before it expires.

#### Video Generation APIs

- [Wan 2.7 video generation API](https://docs.laozhang.ai/en/api-capabilities/wan-video-generation.md): Create Wan 2.7 text-to-video, image-to-video, reference-to-video, and video-editing tasks on LaoZhang API, download the MP4, and check per-second prices.
- [Seedance 2.0 and 2.5 video generation API](https://docs.laozhang.ai/en/api-capabilities/seedance2-video-generation.md): Create Seedance 2.0 and 2.5 video tasks on LaoZhang API, download the MP4, check per-token prices in USD, and reconcile the two call-log rows per task.
- [Seedance real-person and virtual assets API](https://docs.laozhang.ai/en/api-capabilities/seedance2-human-virtual-workflow.md): Verify real people, create real-person and virtual human assets, check their status, and use them in Seedance video tasks with a LaoZhang API key.
- [Sora 2 API retired: move to Wan or Seedance](https://docs.laozhang.ai/en/api-capabilities/sora2/official-forward.md): sora-2 and sora-2-pro no longer work on LaoZhang API. See who is affected, how to save finished videos, and how to switch to Wan 2.7 or Seedance 2.0.

#### Text APIs

- [Text generation API: protocols and models](https://docs.laozhang.ai/en/api-capabilities/text-generation.md): Generate text with LaoZhang API: pick the OpenAI-compatible, Anthropic Messages, or Gemini format, compare models, and read streamed replies.
- [OpenAI protocol: Chat Completions](https://docs.laozhang.ai/en/api-reference/chat-completions.md): Call LaoZhang API text models in the OpenAI Chat Completions format, with cURL and Python examples, streaming, response fields, and error handling.
- [Use OpenAI models with LaoZhang API](https://docs.laozhang.ai/en/api-reference/openai.md): Call GPT-6, GPT-5.6, o3-pro, and OpenAI image, audio, embedding, and moderation models through LaoZhang API: endpoints, SDK setup, and differences.
- [Claude protocol: Anthropic Messages API](https://docs.laozhang.ai/en/api-reference/claude.md): Call LaoZhang API in the Anthropic Messages format: /v1/messages headers, cURL and Python SDK examples, content blocks, streaming, tools, and errors.
- [Gemini protocol: generateContent and SDK](https://docs.laozhang.ai/en/api-reference/gemini.md): Call Gemini's native generateContent endpoint through LaoZhang API with cURL or the Python SDK, and send text, images, PDFs, audio, or MP4 video.

#### Multimodal & Audio APIs

- [Image understanding API: images and PDFs](https://docs.laozhang.ai/en/api-capabilities/vision-understanding.md): Analyze images and PDFs with GPT-6, GPT-5.6, and Gemini through LaoZhang API: URLs, Base64, multiple images, detail, and PDFs in Chat Completions and Responses.
- [Video understanding API: Gemini MP4 analysis](https://docs.laozhang.ai/en/api-capabilities/video-understanding.md): Analyze complete MP4 videos, frames and audio together, with Gemini through LaoZhang API: uploads, URLs, chapters, JSON, clips, frame rate, and the OpenAI SDK.
- [Audio transcription and speech API](https://docs.laozhang.ai/en/api-capabilities/audio-transcription.md): Transcribe audio or create subtitles with whisper-1 and GPT-4o transcribe models, and generate speech with tts-1 or gpt-4o-mini-tts through LaoZhang API.

### Announcements

#### Latest

- [Announcements: models, pricing, and status](https://docs.laozhang.ai/en/changelog.md): Recent LaoZhang API announcements on model launches and retirements, price changes, route status, and the API domain, each linked to its full notice.
- [Nano Banana 2.1 API launch and pricing](https://docs.laozhang.ai/en/announcements/nano-banana-2-1-2026-10.md): Nano Banana 2.1 (gemini-nano-banana-2.1) is live on LaoZhang API at one per-call price for 1K to 4K. See what changed from Nano Banana 2 and how to switch.
- [Seedream 5.0 Flash and 5.0 Pro API launch](https://docs.laozhang.ai/en/announcements/seedream-5-0-flash-pro-2026-09.md): Seedream 5.0 Flash and 5.0 Pro are live on LaoZhang API with per-call pricing. Get the model IDs, prices, sizes, transparent layers, and migration notes.
- [GPT-6 API launch: Astra, Sol, and Luna](https://docs.laozhang.ai/en/announcements/gpt-6-launch-2026-09.md): GPT-6 Astra, Sol, and Luna are live on LaoZhang API. Get the model IDs, standard and long-context prices, how to choose, and API examples.
- [GPT-5.6 Sol API price cut: rates and billing](https://docs.laozhang.ai/en/announcements/gpt-5-6-sol-price-cut-2026-09.md): Compare GPT-5.6 Sol API rates before and after OpenAI's August 21, 2026 price cut, which LaoZhang API applied on September 10, and check your charges.

#### 2026

- [2026 announcement archive](https://docs.laozhang.ai/en/announcements/changelog-archive-2026.md): LaoZhang API announcements from 2026, newest first: model launches and retirements, price changes, route incidents, and the API domain change.
- [GPT Image 2.5 VIP restored on September 22](https://docs.laozhang.ai/en/announcements/gpt-image-2-5-vip-restored-2026-09-22.md): Flare VIP and Sunburst VIP are available again as of September 22, 2026. Resume with a per-call default-group token or switch back from another route.
- [GPT Image 2.5 VIP outage on September 16](https://docs.laozhang.ai/en/announcements/gpt-image-2-5-vip-unavailable-2026-09.md): Record of the September 16, 2026 GPT Image 2.5 VIP capacity outage. Both VIP models were restored on September 22; see the recovery notice to resume.
- [GPT Image 2.5 API launch: models and billing](https://docs.laozhang.ai/en/announcements/gpt-image-2-5-2026-09.md): GPT Image 2.5 launched September 9, 2026 with official-forward Flare and Sunburst, per-call VIP models, and a web route. Compare IDs, groups, and billing.
- [Gemini 3.8 Flash launch: model ID and pricing](https://docs.laozhang.ai/en/announcements/gemini-3-8-flash-2026-09.md): Gemini 3.8 Flash is available on LaoZhang API. Find the model ID, launch pricing, an OpenAI-compatible request, and checks to run before migrating.
- [Grok Imagine Image 2.0 API launch](https://docs.laozhang.ai/en/announcements/grok-imagine-image-2-0-2026-09.md): grok-imagine-image-2.0 launched on September 3, 2026 with 1K/2K output, 15 aspect ratios, up to 10 images per request, and three-reference editing.
- [Legacy Grok Imagine image API](https://docs.laozhang.ai/en/announcements/grok-imagine-2-2026-08.md): Legacy Grok Imagine models grok-imagine-image and grok-imagine-image-quality, launched August 13, 2026: ratios, 1K/2K, reference limits, and pricing.
- [GPT-5.6 Luna and Terra API price cut](https://docs.laozhang.ai/en/announcements/gpt-5-6-pricing-2026-07.md): OpenAI cut GPT-5.6 Luna prices by 80% and Terra by 20% on July 30, 2026, and LaoZhang API applied the new rates. See standard and over-272K pricing.
- [API domain migration: use api2.laozhang.ai](https://docs.laozhang.ai/en/announcements/api-domain-migration-2026-07.md): On July 23, 2026, LaoZhang API moved its default domain to api2.laozhang.ai. Since September 24, the default is api.laozhang.ai, with api2 as fallback.
- [Gemini 3.6 Flash and 3.5 Flash-Lite launch](https://docs.laozhang.ai/en/announcements/gemini-flash-models-2026-07.md): LaoZhang API launched Gemini 3.6 Flash and Gemini 3.5 Flash-Lite on July 22, 2026. Compare the two models, their IDs, and the OpenAI-compatible request.
- [Image API status record: July 22, 2026](https://docs.laozhang.ai/en/announcements/image-api-stability-2026-07.md): On July 22, 2026, gpt-image-2-vip supported 4K and quality again, and Nano Banana Pro, 2, and 2 Lite were stable for production. See IDs and prices then.

### API Reference

#### Core APIs

- [Models API: list available model IDs](https://docs.laozhang.ai/en/api-reference/models.md): List the model IDs your LaoZhang API key can use with GET /v1/models, read the response with cURL or Python, and find prices in the model catalog.
- [Images API: generate and edit images](https://docs.laozhang.ai/en/api-reference/images.md): Generate images from text or edit an existing image with LaoZhang API. Use complete cURL and Python examples to upload files and save the results.

#### Other APIs

- [Embeddings API: turn text into vectors](https://docs.laozhang.ai/en/api-capabilities/text-embedding.md): Create text embeddings with LaoZhang API's /v1/embeddings endpoint: available models, prices, default dimensions, and cURL and Python examples.
- [Moderation API: flag unsafe text](https://docs.laozhang.ai/en/api-capabilities/moderation.md): Check text with omni-moderation-latest through LaoZhang API's /v1/moderations endpoint and read the flagged result and categories in cURL or Python.

### Model Pricing

#### Models and pricing

- [Model Catalog and Pricing](https://docs.laozhang.ai/en/models/index.md): Find LaoZhang API models by use case or vendor: model IDs, per-token and per-call prices, cache and tiered rates, token groups, endpoints, and recent additions.

### Integrations

#### Overview

- [Use LaoZhang API in AI coding tools](https://docs.laozhang.ai/en/scenarios/index.md): Connect Codex CLI, Gemini CLI, OpenCode, Cline, Cherry Studio, and LangChain to LaoZhang API: base URLs, models, and common errors.

#### Coding tools

- [Codex CLI setup with LaoZhang API](https://docs.laozhang.ai/en/scenarios/programming/codex-cli.md): Add LaoZhang API as a custom provider in Codex CLI's config.toml and use GPT-6 through the Responses API to edit code and run commands.
- [Claude Code setup with LaoZhang API](https://docs.laozhang.ai/en/scenarios/programming/claude-code.md): Set the LaoZhang API base URL, key, and model in Claude Code's settings.json and use GLM-5.2 or DeepSeek V4 while Claude is offline.
- [Gemini CLI setup with LaoZhang API](https://docs.laozhang.ai/en/scenarios/programming/gemini-cli.md): Point Gemini CLI at LaoZhang API with GEMINI_API_KEY and GOOGLE_GEMINI_BASE_URL, then code with Gemini 3.8 Flash and other models.
- [OpenCode setup with LaoZhang API](https://docs.laozhang.ai/en/scenarios/programming/opencode.md): Add LaoZhang API to opencode.json: @ai-sdk/openai for GPT-6 and @ai-sdk/openai-compatible for DeepSeek, Gemini, and other models.
- [Cline setup with LaoZhang API](https://docs.laozhang.ai/en/scenarios/programming/cline.md): Set up Cline's OpenAI Compatible provider with LaoZhang API and pick models that call tools reliably in Chat Completions.

#### Chat clients

- [Cherry Studio setup with LaoZhang API](https://docs.laozhang.ai/en/scenarios/chat/cherry-studio.md): Add LaoZhang API as a model provider in Cherry Studio: the API address to use, how to fetch models, and fixes for GPT-6 max_tokens and MCP tool errors.

#### Frameworks

- [LangChain setup with LaoZhang API](https://docs.laozhang.ai/en/scenarios/engineering/langchain.md): Use LaoZhang API from LangChain with ChatOpenAI and OpenAIEmbeddings: models, tool calls, streaming, the Responses API, and embeddings.

### FAQ

#### User Guide

- [Create, store, rotate, and revoke API keys](https://docs.laozhang.ai/en/faq/token-management.md): Create and store LaoZhang API keys, limit each token by quota, IP, model, and expiry, and handle a leaked key or unexplained usage.
- [How do I check my balance with the API?](https://docs.laozhang.ai/en/faq/balance-query-api.md): Check your LaoZhang API balance with GET /api/user/self and a system AccessToken, fix garbled output and 401 errors, and compare AccessTokens and API keys.
- [How to review and use call logs](https://docs.laozhang.ai/en/faq/call-logs.md): What LaoZhang API call logs show, what is not stored by default, how long troubleshooting logs are kept, and which redacted details to send to support.
- [How to check model availability and access](https://docs.laozhang.ai/en/faq/model-availability.md): Confirm a model's exact ID, endpoint, token-group access, and billing with the model and pricing catalog, the console pricing page, and a minimal request.
- [Invalid API key or 404: set the base URL](https://docs.laozhang.ai/en/faq/invalid-api-key.md): Fix invalid_api_key, 401, and 404 errors with a LaoZhang API key: set the right base URL for the OpenAI, Anthropic, and Gemini SDKs.
- [API timeouts: how long should the timeout be?](https://docs.laozhang.ai/en/faq/request-timeout.md): Suggested timeouts for text, reasoning, and image requests on LaoZhang API, why a dropped request is still billed, and how to troubleshoot.
- [How many concurrent requests can I send?](https://docs.laozhang.ai/en/faq/api-concurrency.md): LaoZhang API doesn't currently limit concurrency per account or token. Learn why you can still get a 429 and how to pace requests with a queue and backoff.
- [What is max_tokens and what if I omit it?](https://docs.laozhang.ai/en/faq/max-tokens.md): How the output limit works in Chat Completions, Responses, Anthropic Messages, and Gemini on LaoZhang API, and how to spot truncated output.
- [Do image APIs return a task ID?](https://docs.laozhang.ai/en/faq/image-api-sync.md): LaoZhang API image endpoints are synchronous and return no task ID. Set the right timeout and add an async job queue in your own backend.
- [Does LaoZhang API bill prompt caching?](https://docs.laozhang.ai/en/faq/prompt-cache-billing.md): Which LaoZhang API models have cache-read prices, how to raise your cache hit rate, and how to confirm hits from the usage fields.
- [Why does the API differ from the web app?](https://docs.laozhang.ai/en/faq/api-vs-web-app.md): Why a model seems weaker through LaoZhang API or names the wrong version, how to confirm which model you called, and how to get closer to the web app.
- [Fix Claude Code 400 ValidationException](https://docs.laozhang.ai/en/faq/claude-code-aws-400-validation-error.md): Fix Claude Code 400 ValidationException, Extra inputs are not permitted, and cache_control.scope errors on the AWS Claude route by disabling beta fields.
- [Why a request can fail with remaining balance](https://docs.laozhang.ai/en/faq/balance-insufficient.md): Fix insufficient_user_quota and other failures while your balance looks fine: check the pre-authorized charge, token quota, group, pricing, and input size.
- [Which payment methods are supported?](https://docs.laozhang.ai/en/faq/payment-methods.md): Pay for LaoZhang API by topping up a prepaid balance in the console. See where payment methods are listed, how enterprise invoicing works, and refunds.
- [Which content and uses are prohibited?](https://docs.laozhang.ai/en/faq/content-safety.md): Which uses the LaoZhang API Terms prohibit, what you are responsible for as a user, how upstream model policies apply, and what to check before production.
- [How LaoZhang API handles data and logs](https://docs.laozhang.ai/en/faq/data-security.md): How LaoZhang API handles prompts, responses, request metadata, billing records, account data, and support materials under its Terms and Data Policy.

## Optional

- [TG Channel](https://t.me/laozhang_ai)
