Get started

Quickstart

Get an API key, make your first chat completion, and stream a response. About five minutes with any OpenAI-compatible client.

1. Get an API key

New here? Sign up with Google: name your organisation and first project, pick your Google account, and you start with Rs 1,000 of free credits. Otherwise sign in. Then open API keys. Create a key: give it a name, pick the project it belongs to, and optionally an expiry, a rupee credit cap and the models it may call.

The secret (sk_i2_…) is shown once, on creation. Store it in your environment; the dashboard only ever shows its prefix afterwards.

export I2_API_KEY="sk_i2_…"

2. Make a request

i2 speaks the OpenAI chat completions contract, so the OpenAI SDKs work unchanged: set the base URL and the key, and use an i2 route id as the model.

curl https://api.intelligentinference.ai/v1/chat/completions \
  -H "Authorization: Bearer $I2_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "IntelligentInference/gpt-oss-120b(Global)",
    "messages": [
      {"role": "user", "content": "Explain what an inference gateway does, in two sentences."}
    ]
  }'

The response is the standard shape: choices[0].message.content holds the reply and usage carries the token counts the request was billed on.

{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "IntelligentInference/gpt-oss-120b(Global)",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "An inference gateway sits between…" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 21, "completion_tokens": 58, "total_tokens": 79 }
}

3. Stream it

Add "stream": true and tokens arrive as server-sent events, ending with data: [DONE].

curl -N https://api.intelligentinference.ai/v1/chat/completions \
  -H "Authorization: Bearer $I2_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "IntelligentInference/gpt-oss-120b(Global)",
    "stream": true,
    "messages": [{"role": "user", "content": "Count to ten, slowly."}]
  }'

4. See what it cost

Every request appears in the dashboard's Request logs within seconds, with its status, latency, time to first token, token counts and cost in rupees. For a per-request figure inside your own code, send X-K2I-Debug-Metrics: true on a streaming request and read the extra chunk the gateway appends after [DONE]; see Streaming and debug metrics.

Next

Something unclear or wrong on this page? Tell us. Machine-readable copies: llms.txt.