User Guide
Using the API
Replace OpenAI's base_url with the platform URL and use your platform token as api_key to start calling.
Replace OpenAI's `base_url` with the platform URL and use your platform token as `api_key` to start calling. Production paths are `/v1/*`; the online Playground uses `/pg/chat/completions` for debugging, which differs from the production API path.
Playground online test
The Playground is a built-in online tool to chat with models without writing code—ideal for quickly verifying your token.
Open the Playground
- In the top nav go to Demo → Chat Demo, or visit
/demo/chat - On Token Management , click Chat on a token to enter the Playground with that token
Use the Playground
- On the left, choose text / image / video mode, group, and model (when opened from a token page, available models are restricted)
- Type a message in the input at the bottom and click Send
- The conversation area shows the model reply
Playground preview: pick a model on the left, chat in the center, inspect request/response on the right (layout is illustrative)
Get API address
The default API address is https://token.easyapi.com. You can override it at deploy time with the NUXT_PUBLIC_API_BASE_URL env var; OpenAI SDK base_url must append /v1.
Copy API address
- Check the request URL generated for the current site in the code-example Playground panel
- Or confirm NUXT_PUBLIC_API_BASE_URL in your deployment environment / admin docs
- For production calls use as the OpenAI-compatible base_url
OpenAI-compatible Base URL
https://token.easyapi.com/v1Configure client
Paste the copied URL as base_url in your client or code, together with your platform token as api_key to start calling.
- HTTP header: Authorization: Bearer YOUR_API_KEY
- Token Management Chat menu can import Lobe Chat, OpenCat, etc. with the API base URL pre-filled
- See API authenticationfor full auth details
Code examples
Addresses below match the current site config; replace sk-xxxxxxxx with your real token.
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxxxxxxxxxxxx", # Platform-issued token
base_url="https://token.easyapi.com/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Claude native format
curl https://token.easyapi.com/v1/messages \
-H "x-api-key: sk-xxxxxxxx" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model": "claude-3-5-sonnet-20241022", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}]}'Gemini native format
curl "https://token.easyapi.com/v1beta/models/gemini-1.5-pro:generateContent?key=sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "Hello"}]}]}'Supported API endpoints
EasyAPI exposes OpenAI-compatible REST endpoints; whether a model supports an endpoint depends on backend channel configuration.
| API | Path | Description |
|---|---|---|
| Chat completions | POST /v1/chat/completions | Dialogue generation with streaming support |
| Text completions | POST /v1/completions | Legacy completions API |
| Embeddings | POST /v1/embeddings | Text vectorization |
| Image generation | POST /v1/images/generations | Text-to-image |
| Image edits | POST /v1/images/edits | Image editing |
| Speech-to-text | POST /v1/audio/transcriptions | Whisper, etc. |
| Text-to-speech | POST /v1/audio/speech | TTS |
| Rerank | POST /v1/rerank | Document reranking |
| Responses API | POST /v1/responses | OpenAI Responses format |
| Realtime | GET /v1/realtime(WebSocket) | OpenAI Realtime API |
| Model list | GET /v1/models | List available models |