Home›Developer Center›OpenAI ChatGPT API

OpenAI ChatGPT API

API DocumentationOpenAI ChatGPT APIAnthropic (Claude) APIGoogle Gemini APIGoogle Search APIGoogle News APIOpenRouter APIAPI Pricing
CLI & Agent Guidescc-switch macOScc-switch Windowscc-switch LinuxOpenCode macOSOpenCode WindowsOpenCode LinuxOpenClaw macOSOpenClaw WindowsOpenClaw LinuxHermes Agent macOSHermes Agent WindowsHermes Agent LinuxClaude Code CLI macOSClaude Code CLI WindowsClaude Code CLI LinuxCodex CLI macOSCodex CLI WindowsCodex CLI Linux
MYAI168 API & MCPMYAI168 MCP CLIMYAI168 MCP Web & App
No matching questions on this page.Search the whole site
OpenAI

OpenAI API Relay

POST https://www.myai168.com/en/api/openai/v1/responses

Responses API (new chat interface with streaming support).

curl https://www.myai168.com/en/api/openai/v1/responses \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-sol","input":"Hello"}'
import requests

r = requests.post(
    "https://www.myai168.com/en/api/openai/v1/responses",
    headers={"Authorization": "Bearer YOUR_DEV_KEY"},
    json={"model": "gpt-5.6-sol", "input": "Hello"},
)
print(r.json())

POST https://www.myai168.com/en/api/openai/v1/chat/completions

Chat Completions API (legacy chat interface, OpenAI SDK compatible).

curl https://www.myai168.com/en/api/openai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-sol","messages":[{"role":"user","content":"Hello"}]}'
import requests

r = requests.post(
    "https://www.myai168.com/en/api/openai/v1/chat/completions",
    headers={"Authorization": "Bearer YOUR_DEV_KEY"},
    json={"model": "gpt-5.6-sol", "messages": [{"role": "user", "content": "Hello"}]},
)
print(r.json())

POST https://www.myai168.com/en/api/openai/v1/audio/speech

Text-to-speech (TTS). Returns audio binary.

curl https://www.myai168.com/en/api/openai/v1/audio/speech \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"tts-1","input":"Hello","voice":"nova"}' \
  --output speech.mp3
import requests

r = requests.post(
    "https://www.myai168.com/en/api/openai/v1/audio/speech",
    headers={"Authorization": "Bearer YOUR_DEV_KEY"},
    json={"model": "tts-1", "input": "Hello", "voice": "nova"},
)
with open("speech.mp3", "wb") as f:
    f.write(r.content)

POST https://www.myai168.com/en/api/openai/v1/audio/transcriptions

Speech-to-text (STT, multipart upload).

curl https://www.myai168.com/en/api/openai/v1/audio/transcriptions \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -F file=@audio.mp3 \
  -F model=gpt-4o-transcribe
import requests

with open("audio.mp3", "rb") as f:
    r = requests.post(
        "https://www.myai168.com/en/api/openai/v1/audio/transcriptions",
        headers={"Authorization": "Bearer YOUR_DEV_KEY"},
        files={"file": f},
        data={"model": "gpt-4o-transcribe"},
    )
print(r.json())

POST https://www.myai168.com/en/api/openai/v1/audio/translations

Translate speech to English text (STT + translate). The official OpenAI translations endpoint only supports whisper-1 (gpt-4o-transcribe is for transcriptions only); the examples pass response_format=verbose_json to get the full JSON including audio duration.

curl https://www.myai168.com/en/api/openai/v1/audio/translations \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -F file=@audio.mp3 \
  -F model=whisper-1 \
  -F response_format=verbose_json
import requests

with open("audio.mp3", "rb") as f:
    r = requests.post(
        "https://www.myai168.com/en/api/openai/v1/audio/translations",
        headers={"Authorization": "Bearer YOUR_DEV_KEY"},
        files={"file": f},
        data={"model": "whisper-1", "response_format": "verbose_json"},
    )
print(r.json())

POST https://www.myai168.com/en/api/openai/v1/images/generations

Text-to-image (gpt-image-2).

curl https://www.myai168.com/en/api/openai/v1/images/generations \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-image-2","prompt":"A cute cat","size":"1024x1024"}'
import requests

r = requests.post(
    "https://www.myai168.com/en/api/openai/v1/images/generations",
    headers={"Authorization": "Bearer YOUR_DEV_KEY"},
    json={"model": "gpt-image-2", "prompt": "A cute cat", "size": "1024x1024"},
)
print(r.json())

POST https://www.myai168.com/en/api/openai/v1/embeddings

Text embeddings (OpenAI-compatible format; accepted models voyage-4 / voyage-4-large, billed per input token).

curl https://www.myai168.com/en/api/openai/v1/embeddings \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"voyage-4-large","input":"Hello"}'
import requests

r = requests.post(
    "https://www.myai168.com/en/api/openai/v1/embeddings",
    headers={"Authorization": "Bearer YOUR_DEV_KEY"},
    json={"model": "voyage-4-large", "input": "Hello"},
)
print(r.json())

GET https://www.myai168.com/en/api/openai/v1/audio/voices

List available built-in TTS voices (query endpoint, free). Note: this GET listing is a site extension — the official OpenAI API reference only documents POST (create custom voice) and has no GET list endpoint, so do not expect it in the official SDK surface.

curl https://www.myai168.com/en/api/openai/v1/audio/voices \
  -H "Authorization: Bearer YOUR_DEV_KEY"

POST https://www.myai168.com/en/api/openai/v1/audio/voices

Custom voice creation (voice cloning, multipart upload; fields: audio_sample voice sample file required, consent consent recording ID required (e.g. cons_1234 — per the official OpenAI spec this is obtained by uploading a consent recording first, not a free-text consent statement), name voice name). OpenAI currently limits custom voices to eligible accounts.

curl https://www.myai168.com/en/api/openai/v1/audio/voices \
  -H "Authorization: Bearer YOUR_DEV_KEY" \
  -F audio_sample=@sample.mp3 \
  -F consent="cons_1234" \
  -F name="My Voice"

GET https://www.myai168.com/en/api/openai/v1/models / GET https://www.myai168.com/en/api/openai/v1/models/{model}

List supported models / retrieve one model (compatible with SDK models.list / models.retrieve; query endpoints, free).

curl https://www.myai168.com/en/api/openai/v1/models \
  -H "Authorization: Bearer YOUR_DEV_KEY"

curl https://www.myai168.com/en/api/openai/v1/models/gpt-5.6-sol \
  -H "Authorization: Bearer YOUR_DEV_KEY"
Supported endpoints and features (support matrix)

Support Matrix

Some OpenAI SDK features behave differently through this relay. Check this matrix before integrating to avoid surprises.

  • GET /v1/models and GET /v1/models/{model} — supported (compatible with SDK models.list / models.retrieve). Returns exactly the models this relay accepts; models not in the list are rejected with "No pricing info! Please use other models!".
  • POST /v1/responses and POST /v1/chat/completions — supported, including streaming.
  • Web search — supported and billed per search: Responses API tools: [{"type": "web_search"}], Chat Completions web_search_options.
  • Other hosted tools (code_interpreter, file_search, image_generation, computer use, hosted MCP) — not supported, HTTP 400. Use client-side function calling instead.
  • Audio endpoints (speech / transcriptions / translations / voices — GET lists built-in voices for free, POST creates a custom voice), images/generations and embeddings (accepted models voyage-4 / voyage-4-large) — supported.
  • Non-streaming responses include X-Cost-Points (points charged) and X-Credits-Remaining (balance after the call) headers. Streaming responses append the same information after the final event (data: [DONE]) as SSE comment lines : cost=N / : credits-remaining=M. You can also query your balance any time with GET https://www.myai168.com/en/api/user/get_credits.
  • Failed calls, and calls where the vendor returns no usage info, are never charged.
Request parameters, response format and error codes

Request parameters (POST https://www.myai168.com/en/api/openai/v1/chat/completions)

The request body is JSON, identical to the official OpenAI spec. Authenticate with an Authorization: Bearer YOUR_API_KEY header (never place keys in URL query strings).

ParameterTypeRequiredDescription
modelstringrequiredModel id (e.g. gpt-5.6-sol). Must be in the GET /v1/models list, otherwise 400 with "No pricing info! Please use other models!".
messagesarrayrequiredConversation messages. role supports all official roles: developer / system / user / assistant / tool (the legacy function role is deprecated but still accepted); content can be a string or an array of content parts (text / image / audio, per the official format).
streambooleanoptionaltrue streams the response as SSE (data: {JSON} chunks, ending with data: [DONE]).
web_search_optionsobjectoptionalEnables web search (billed per use).
max_tokens / temperature / top_p / tools (function calling) etc.—optionalOther official parameters are forwarded as-is; hosted tools (code_interpreter etc.) are not supported and return 400.

The Responses API (POST /v1/responses) uses input (string or array, required) and model (required) instead, and accepts tools: [{"type": "web_search"}]; other official parameters are forwarded as-is.

Response format

Non-streaming: official JSON — Chat Completions text is in choices[0].message.content with usage in usage; Responses text must be parsed from the output[] array (in items whose type is message, take the text field of content[] blocks whose type is output_text) — output_text is a convenience property of the official Python / JavaScript SDKs, not a field of the raw REST JSON. Response headers include X-Cost-Points (points charged) and X-Credits-Remaining (balance after the call).

Streaming: SSE chunks with Chat Completions deltas in choices[0].delta.content, ending with data: [DONE]; after the final event the stream appends SSE comment lines : cost=N / : credits-remaining=M with the points charged and remaining balance (spec-compliant SSE parsers and official SDKs ignore comment lines). You can also query GET https://www.myai168.com/en/api/user/get_credits any time.

Streaming example

curl -N https://www.myai168.com/en/api/openai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-sol","stream":true,"messages":[{"role":"user","content":"Hello"}]}'
data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hi"},"index":0}]}

data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{},"finish_reason":"stop","index":0}]}

data: [DONE]

Error codes

HTTP statusMeaning
401Missing or invalid API key (repeated failures from the same IP are temporarily blocked).
402Insufficient credits (please top up).
400Invalid request body, model not in the supported list ("No pricing info! Please use other models!"), or an unsupported hosted tool was requested.
502Upstream vendor error — never charged.

No points are ever charged on errors (including when the vendor returns no usage info).

Next page: Anthropic (Claude) API ›
↑
Question link copied.

Other FAQ pages

API Documentation

  • Anthropic (Claude) API
  • Google Gemini API
  • Google Search API
  • Google News API
  • OpenRouter API
  • API Pricing

CLI & Agent Guides

  • cc-switch macOS
  • cc-switch Windows
  • cc-switch Linux
  • OpenCode macOS
  • OpenCode Windows
  • OpenCode Linux
  • OpenClaw macOS
  • OpenClaw Windows
  • OpenClaw Linux
  • Hermes Agent macOS
  • Hermes Agent Windows
  • Hermes Agent Linux
  • Claude Code CLI macOS
  • Claude Code CLI Windows
  • Claude Code CLI Linux
  • Codex CLI macOS
  • Codex CLI Windows
  • Codex CLI Linux

MYAI168 API & MCP

  • MYAI168 MCP CLI
  • MYAI168 MCP Web & App