1Inference

Dokumentasi API 1Inference

Dokumentasi 1Inference adalah referensi lengkap endpoint OpenAI-compatible yang dipakai platform ini: chat completion, image generation, text-to-speech, autentikasi, batas laju, dan kode error, semuanya ditagih dalam Rupiah.

Base URL
https://api.1inference.com/v1
Auth
Authorization: Bearer sk_...
Format
OpenAI-compatible JSON, SSE untuk streaming
Versi Markdown
https://1inference.com/docs.md

Referensi API

OpenAI-compatible chat, image, and text-to-speech API billed in Indonesian Rupiah. Humans browse the guide at https://1inference.com/docs. This file is the compact version for agents and scripts.

Base URL: https://api.1inference.com/v1

Auth header: Authorization: Bearer sk_...

Create a key at https://1inference.com/dashboard/api-keys. Keys start with sk_ and are shown once.

Endpoints

MethodPathStatusNotes
POST/v1/chat/completionsavailableOpenAI Chat Completions shape, JSON or SSE
POST/v1/images/generationsavailableOpenAI Image Generation shape
POST/v1/audio/speechavailableBinary audio response
GET/v1/modelsavailableCatalog with Rupiah prices
GET/v1/models/{id}availableOne model from the same cached snapshot
POST/v1/embeddingsnot availableReturns 503
POST/v1/audio/transcriptionsnot availableReturns 503
POST/v1/completionsnot availableReturns 503
POST/v1/video/generationsnot availableReturns 503
POST/v1/music/generationsnot availableReturns 503

Model IDs are the plain catalog names, for example deepseek-v4.1-flash, gpt-4o-mini, claude-sonnet-4.5. Read GET /v1/models for the current list; examples here can age.

Chat completions

curl https://api.1inference.com/v1/chat/completions \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{"role": "user", "content": "Halo!"}],
    "max_tokens": 512,
    "stream": false
  }'

Parameters:

NameTypeRequiredNotes
modelstringyesCatalog ID, max 128 characters
messagesarrayyesAt least one message with role and content
streambooleannoDefault false. true returns SSE
max_tokensintegernoOlder alias of max_completion_tokens
max_completion_tokensintegernoWhen neither field is set the server sends 4096
temperaturenumberno0 to 2. Model default when omitted
top_pnumberno0 to 1. Model default when omitted
stopstring or arraynoStop sequences
toolsarraynoOpenAI function format
tool_choicestring or objectnoauto, none, required, or one tool
response_formatobjectnoFor example {"type": "json_object"}
stream_optionsobjectnoFor example {"include_usage": true}

Response:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1713200000,
  "model": "deepseek-v4.1-flash",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Halo!" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21 }
}

The answer text is at choices[0].message.content.

With stream: true the body is text/event-stream in OpenAI chunk format and normally ends with data: [DONE]. The gateway stops retrying once the first chunk reaches the client.

Models

curl https://api.1inference.com/v1/models \
  -H "Authorization: Bearer sk_your_api_key"

Each entry has id, name, pricing, discount_percent, and seller_count, plus media_unit for image and audio models. The payload also carries exchange_rate (USD to IDR).

Image generation

{
  "model": "venice-z-image-turbo",
  "prompt": "Matahari terbenam di atas pulau tropis",
  "n": 1,
  "size": "1024x1024",
  "quality": "high",
  "response_format": "url"
}

n must be 1; the upstream returns 400 for larger values. response_format is b64_json by default, and url depends on the model. Image models bill per token, per image, or per megapixel; media_unit on the catalog entry says which.

Text to speech

{
  "model": "tts-minimax-speech-02-hd",
  "input": "Halo, selamat datang di 1Inference!",
  "voice": "WiseWoman",
  "response_format": "mp3",
  "speed": 1,
  "streaming": false
}

The response body is binary audio and Content-Type follows the format (for example audio/mpeg). Upstream accepts mp3, opus, aac, and flac; it rejects wav and pcm. voice must belong to the chosen model. No endpoint lists voices, so check the model documentation before relying on a name.

Errors

{
  "error": {
    "message": "Insufficient balance",
    "type": "invalid_request_error",
    "code": "insufficient_balance",
    "status": 402
  },
  "request_id": "req_01J..."
}

request_id is present when the gateway has one. Messages are in English.

HTTPCodeTypeMeaning
400invalid_requestinvalid_request_errorBad field or malformed JSON
400model_too_longinvalid_request_errormodel is longer than 128 characters
401invalid_api_keyinvalid_request_errorKey missing, malformed, revoked, or unknown
401key_expiredinvalid_request_errorKey past its expiry
402insufficient_balanceinvalid_request_errorBalance below the estimated cost
402reservation_expiredinvalid_request_errorHold expired before the request finished
403model_not_availableinvalid_request_errorModel closed or blocked
404model_not_foundinvalid_request_errorNo seller offers that model ID
429rate_limit_exceededrate_limit_errorA rate or concurrency limit was hit
429provider_rate_limitedprovider_errorUpstream rate limited the request
500internal_errorserver_errorUnexpected server error
502provider_errorprovider_errorUpstream provider error
503provider_unavailableserver_errorNo upstream reachable
503exchange_rate_unavailableserver_errorUSD to IDR rate unavailable
503authentication_service_unavailableserver_errorAuth service unreachable
503minimum_discount_not_metserver_errorNo seller meets the minimum discount
504provider_timeoutprovider_errorUpstream timed out

Retries: the gateway retries 500, 502, 504, and timeouts inside a provider tier after 2 to 3 seconds, then moves to the next tier. It moves to the next tier immediately on 429 and 503. It returns 400, 401, 402, 403, and 404 unchanged. No Retry-After header is sent. Do not replay 400, 401, 402, 403, or 404 blindly; fix the request or the balance first.

Billing: a request that succeeded and is sent again is billed twice. A request that failed at the upstream can still be billed for work the upstream did, especially images, TTS, and cancelled streams. Check the usage page before replaying a step.

Rate limits

LayerScopeLimitWindow
Globalall users20,000 requests1 minute
Per useruser ID2,000 requests1 minute
Per API keyAPI key1,000 requests1 minute
Per modelmodel name2,000 requests1 minute
Concurrencyuser ID400 open requestswhile running

No X-RateLimit headers are sent. Read the 429 body and back off. The limits are configuration, so treat this table as current defaults.

Top up

Minimum top up is Rp10.000, paid by QRIS or card through Midtrans. A top up is pending while it waits, then completed after payment settles or failed when the payment expires. Credit is written before the status becomes completed.

Platform integrations

Shared rules for n8n, Make, and Zapier

  • Keep stream: false on HTTP steps. Make and Zapier read one JSON body and do not render SSE; n8n's Chat Model node handles SSE itself, but an HTTP Request node still needs a plain response.
  • Map the answer from choices[0].message.content, not the whole body.
  • Set max_tokens between 256 and 1024 so the answer finishes inside the platform timeout.
  • Timeouts: Zapier 30 s per step, Make 40 s by default (300 s maximum), n8n per node.
  • Every retry is a new request and is billed again. Retry only after reading the error.
  • Put the key in the platform credential or a step header only editors can see, never in the JSON body or a prompt.

Common failures: 401 invalid_api_key (header missing or Bearer left out), 402 insufficient_balance (top up), 404 model_not_found (refresh the ID from GET /v1/models), 400 invalid_request (broken JSON or wrong types), 429 (wait and back off), timeout (lower max_tokens or pick a faster model), empty answer (wrong mapping path or stream: true).

n8n

  1. Add a trigger such as When chat message received.
  2. Add an AI Agent node and connect the trigger to its main input.
  3. On the Chat Model port add an OpenAI Chat Model sub-node.
  4. Create an OpenAI credential: API key is the sk_ key, Base URL is https://api.1inference.com/v1. The Base URL must end in /v1.
  5. Pick a model from the list, or switch the Model field to expression mode and paste the catalog ID.
  6. Run the workflow once.

If the model dropdown stays empty, type the ID. The Chat Model node returns text only; for images or audio use an HTTP Request node with the same credential.

Make

  1. Add HTTP > Make a request.
  2. Method POST, URL https://api.1inference.com/v1/chat/completions.
  3. Headers: Authorization: Bearer sk_... and Content-Type: application/json.
  4. Body type Raw, content type JSON, paste the JSON body.
  5. Turn on Parse response so the reply becomes fields, not a text blob.
  6. Map choices, first item, message.content into the next module.

Default timeout is 40 seconds (300 maximum). Add an error handler route for 402 and 429 instead of a blind retry.

Zapier

  1. Add Webhooks by Zapier > Custom Request.
  2. Method POST, URL https://api.1inference.com/v1/chat/completions.
  3. Headers: Authorization: Bearer sk_... and Content-Type: application/json.
  4. Paste the JSON body in Data. Set Data Pass-Through to No, Unflatten to No, and Return Raw Response to No so Zapier parses the reply.
  5. Map choices, first item, message.content into the next step.

A Zap step has 30 seconds. AI by Zapier calls OpenAI directly and cannot be pointed at this API. The key lives in the Custom Request header, so restrict who can edit the Zap.

Pricing and payment

Prices are in Rupiah with USD alongside, from GET /v1/models. Chat bills per token, images per token, image, or megapixel, and TTS per character. The catalog price is the final price you pay; no subscription fee applies.

Verification

The rate limits, top-up minimum, and error codes in this file are checked against the backend source by frontend/scripts/check-docs-truth.mjs. Run it with npm run docs:check from frontend/.

API chat, gambar, dan teks ke suara yang kompatibel dengan OpenAI, ditagih dalam Rupiah.