Skip to main content
This section assumes you have already:
  1. Completed registration.
  2. Created an API key.
  3. Have available credit on your account (the new-user trial credit is enough).

Basics

Test with cURL

Expected response:

Python — official openai SDK

Node.js / TypeScript

Streaming output

Add stream: true to the request body to use an SSE stream:

Switch to the Claude / Gemini native protocols

If your code originally uses the Anthropic or Google SDK, there’s no need to rewrite it — just point base_url at OpenPAI:

Debugging tips

  • Log the x-openpai-request-id response header — it speeds up diagnosis when you open a support ticket.
  • Use https://openp.ai/v1/models to list the models the current key can access.
  • Console → Logs shows each call’s model, token usage and billing details (prompt / response content is not recorded).

Next steps

Client integrations

Connect in Cherry Studio / LobeChat / Cursor / Dify.

Advanced features

Streaming, tool calls, vision, reasoning, structured output.