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.xin

SDK integrations usually use:

https://api.oimi.xin/v1

Use the Base URL shown in the API access section of your console.

Authentication

OpenAI-compatible endpoints use a Bearer token:

Authorization: Bearer $API_KEY

Claude Messages also supports Claude-style headers:

x-api-key: $API_KEY
anthropic-version: 2023-06-01

Gemini endpoints support:

x-goog-api-key: $API_KEY

Or:

?key=$API_KEY

OpenAI-Compatible Endpoints

Chat Completions

POST /v1/chat/completions
curl 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/models

Returns 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/compact

Use 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/messages
curl 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}:streamGenerateContent
curl 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.

CapabilityEndpoint
Chat CompletionsPOST /v1/chat/completions
ResponsesPOST /v1/responses
Responses CompactPOST /v1/responses/compact
Claude MessagesPOST /v1/messages
Gemini Generate ContentPOST /v1beta/models/{model}:generateContent
RerankPOST /v1/rerank
ImagesPOST /v1/images/generations
EmbeddingsPOST /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.