curl
In these examples sk-xxxx stands for your token and YOUR_MODEL for a model on the pricing page that is available in your group. Put the token in an environment variable first, so it does not end up in your shell history:
export OPENPALMLAB_API_KEY=sk-xxxxOpenAI Chat Completions
Section titled “OpenAI Chat Completions”curl https://api.openpalm.ai/v1/chat/completions \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_MODEL", "messages": [{"role": "user", "content": "Hello"}], "stream": true }'OpenAI Responses
Section titled “OpenAI Responses”curl https://api.openpalm.ai/v1/responses \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_MODEL", "input": "Hello" }'Anthropic Messages
Section titled “Anthropic Messages”curl https://api.openpalm.ai/v1/messages \ -H "x-api-key: $OPENPALMLAB_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_MODEL", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}] }'Gemini generateContent
Section titled “Gemini generateContent”curl "https://api.openpalm.ai/v1beta/models/YOUR_MODEL:generateContent" \ -H "x-goog-api-key: $OPENPALMLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "contents": [{"parts": [{"text": "Hello"}]}] }'Embeddings
Section titled “Embeddings”curl https://api.openpalm.ai/v1/embeddings \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_EMBEDDING_MODEL", "input": "The quick brown fox" }'Image generation
Section titled “Image generation”curl https://api.openpalm.ai/v1/images/generations \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_IMAGE_MODEL", "prompt": "A watercolor painting of a lighthouse at dawn", "size": "1024x1024" }'Whether size, n, quality and similar fields take effect depends on the model; write the body in the OpenAI images format. Whether the image comes back as a link or as base64 also depends on the model and channel.
Text to speech
Section titled “Text to speech”curl https://api.openpalm.ai/v1/audio/speech \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_TTS_MODEL", "input": "Hello, welcome to OpenPalmLab.", "voice": "alloy" }' \ --output speech.mp3Which voices are available depends on the model.
Speech to text
Section titled “Speech to text”curl https://api.openpalm.ai/v1/audio/transcriptions \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY" \ -F model=YOUR_STT_MODEL \This endpoint takes a file as multipart/form-data; do not add a Content-Type header yourself.
Rerank
Section titled “Rerank”curl https://api.openpalm.ai/v1/rerank \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_RERANK_MODEL", "query": "What is a vector database?", "documents": ["A vector database stores and searches vectors.", "The weather is nice today."], "top_n": 1 }'The image, audio and rerank endpoints above need a model and channel of that type in your group. Availability depends on what the site has enabled; filter the pricing page by endpoint type to check.
List available models
Section titled “List available models”curl https://api.openpalm.ai/v1/models \ -H "Authorization: Bearer $OPENPALMLAB_API_KEY"Other clients
Section titled “Other clients”Command-line clients: Claude Code, Codex CLI, Gemini CLI, OpenCode. Web chat: OpenPalm Chat.