API Reference
Review the Oimi API Base URL, authentication methods, and common protocol endpoints.
API Reference
Oimi API provides a unified entry point for model calls. You can use an API key to call models visible in your console, and review model information, usage, and costs from Models, Usage, and Costs.
Base URL
https://api.oimi.xinSDK integrations usually use:
https://api.oimi.xin/v1Use the Base URL shown in the API access section of your console.
Authentication
OpenAI-compatible endpoints use a Bearer token:
Authorization: Bearer $API_KEYClaude Messages also supports Claude-style headers:
x-api-key: $API_KEY
anthropic-version: 2023-06-01Gemini endpoints support:
x-goog-api-key: $API_KEYOr:
?key=$API_KEYOpenAI-Compatible Endpoints
Chat Completions
POST /v1/chat/completionscurl https://api.oimi.xin/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "model-id",
"messages": [
{ "role": "user", "content": "Write an API integration guide" }
],
"stream": true
}'Replace model-id with an actual model ID from Models.
Models
GET /v1/modelsReturns the models accessible by the current API key. Availability can depend on account permissions, model variant, and current service configuration. Use the Models page in the console as the source of truth.
OpenAI Responses
POST /v1/responses
POST /v1/responses/compactUse these endpoints for applications built around the Responses API shape. Whether a selected model supports the endpoint depends on the actual request result.
Claude Messages
POST /v1/messagescurl https://api.oimi.xin/v1/messages \
-H "x-api-key: $API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "model-id",
"max_tokens": 1024,
"messages": [
{ "role": "user", "content": "Draft a product update note" }
]
}'Gemini
POST /v1beta/models/{model}:generateContent
POST /v1beta/models/{model}:streamGenerateContentcurl https://api.oimi.xin/v1beta/models/model-id:generateContent \
-H "x-goog-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{ "parts": [{ "text": "Write a welcome email" }] }
]
}'Other Supported Capabilities
In addition to the common protocol endpoints above, the platform may expose image, embedding, rerank, and related capabilities. Whether a capability is callable depends on the models visible to your account, model capability, and current service configuration.
Before integration, confirm the model ID in Models, then test with the corresponding protocol.
| Capability | Endpoint |
|---|---|
| Chat Completions | POST /v1/chat/completions |
| Responses | POST /v1/responses |
| Responses Compact | POST /v1/responses/compact |
| Claude Messages | POST /v1/messages |
| Gemini Generate Content | POST /v1beta/models/{model}:generateContent |
| Rerank | POST /v1/rerank |
| Images | POST /v1/images/generations |
| Embeddings | POST /v1/embeddings |
Error Format
API errors use an OpenAI-style structure:
{
"error": {
"message": "Error description",
"type": "new_api_error",
"code": "access_denied"
}
}Common causes include invalid API key, insufficient account balance, insufficient API key quota, unavailable model, wrong service URL, wrong authentication header, rate limiting, or temporary upstream service issues.