Skip to main content

Documentation Index

Fetch the complete documentation index at: https://xingchao.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through making your first API calls to GlobalAI OPC. By the end, you will have generated text with a GPT model, created an image with Nano Banana, and kicked off a Sora video generation — all using the same Bearer token authentication pattern.
Image and video generation are asynchronous. When you create a task, the API returns a task ID immediately. You must poll the result endpoint until the status changes to completed before you can access the generated file.
1

Get an API Key

Contact the GlobalAI OPC team to obtain your API key. Once you have it, store it securely — never hard-code it in source files or commit it to version control.Set your key as an environment variable so your code can read it without embedding it in plain text:
export GLOBALAIOPC_API_KEY="your_api_key_here"
Add the export line to your shell profile (e.g. ~/.bashrc or ~/.zshrc) so the variable persists across sessions. For production environments, use a dedicated secrets manager such as AWS Secrets Manager, HashiCorp Vault, or your platform’s built-in secrets store.
2

Make a Text Generation Call

Send a chat completion request to the text API endpoint. The endpoint is fully OpenAI-compatible, so any code or SDK that works with OpenAI’s chat/completions API works here with only a base URL change.
curl -X POST http://apillm.globalaiopc.com/gw_llm_power/v1/chat/completions \
  -H "Authorization: Bearer $GLOBALAIOPC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "messages": [
      {
        "role": "user",
        "content": "Hello, introduce yourself"
      }
    ]
  }'
A successful response looks like this:
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1761635478,
  "model": "gpt-5.4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hi! I'm an AI assistant powered by GlobalAI OPC. I'm here to help you with questions, writing, analysis, and much more. How can I assist you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 34,
    "total_tokens": 46
  }
}
3

Generate an Image

Submit an image generation request to the Nano Banana endpoint. The API returns a task ID immediately — you will poll for the result in the next step.
Save the task id from the response right away. You’ll need it to retrieve your generated image.
curl -X POST https://zcbservice.aizfw.cn/kyyReactApiServer/v1/banana/images \
  -H "Authorization: Bearer $GLOBALAIOPC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-2",
    "prompt": "A cute orange cat sitting on a windowsill",
    "size": "16:9"
  }'
The response confirms the task is queued:
{
  "id": "abc123def456",
  "object": "image",
  "created": 1761635478,
  "model": "nano-banana-2",
  "status": "queued"
}
4

Poll for the Image Result

Query the result endpoint with your task ID until the status is completed. The completed response includes a direct URL to your generated image.
Poll every 30–60 seconds. Polling too frequently can result in rate limiting and doesn’t speed up generation.
curl -X GET https://zcbservice.aizfw.cn/kyyReactApiServer/v1/result/abc123def456 \
  -H "Authorization: Bearer $GLOBALAIOPC_API_KEY"
When the image is ready, the response includes the image URL:
{
  "id": "abc123def456",
  "object": "image",
  "status": "completed",
  "model": "nano-banana-2",
  "image_url": "https://cdn.example.com/generated/abc123def456.png"
}
5

Generate a Video

Submit a video generation request to the Sora endpoint. Like image generation, this is asynchronous — the API returns a task ID that you poll until the video is ready.
Save the task id from the response immediately. Video generation can take several minutes, and you’ll need the ID to retrieve your result.
cURL
curl -X POST https://zcbservice.aizfw.cn/kyyReactApiServer/v1/sora/videos \
  -H "Authorization: Bearer $GLOBALAIOPC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openAiSora2Plus",
    "prompt": "Ocean waves crashing on the shore",
    "aspect_ratio": "16:9",
    "seconds": 8
  }'
The response confirms the task is queued:
{
  "id": "vid789xyz012",
  "object": "video",
  "created": 1761635500,
  "model": "openAiSora2Plus",
  "status": "queued"
}
Poll for the video result using the same result endpoint:
cURL
curl -X GET https://zcbservice.aizfw.cn/kyyReactApiServer/v1/result/vid789xyz012 \
  -H "Authorization: Bearer $GLOBALAIOPC_API_KEY"
When the video is ready, the completed response includes the video URL:
{
  "id": "vid789xyz012",
  "object": "video",
  "status": "completed",
  "model": "openAiSora2Plus",
  "video_url": "https://cdn.example.com/generated/vid789xyz012.mp4"
}

Next Steps

You’ve made your first text, image, and video generation calls. Explore the full API reference to discover all available models, parameters, and capabilities.

Authentication

Learn how to manage API keys and protect them with environment variables and secrets managers.

API Reference

Browse every endpoint, request parameter, and response schema for all three API categories.