Kimi K3 Quick Start for Long-Context API Workflows

Kimi K3 Quick Start for Long-Context API Workflows

Kimi K3 is available through Novita AI’s serverless API with the model ID moonshotai/kimi-k3, an OpenAI-compatible chat endpoint, a 1,048,576-token context window, and a 1,048,576-token maximum output setting listed on its model page. This quick start shows how to authenticate, send a first request, parse the response, and plan for Kimi K3’s token pricing before you connect it to a larger application.

When to Use This Quick Start

Use this guide when you want to test Kimi K3 from an application that already speaks the OpenAI API format. It is a practical starting point for long-context software engineering, document analysis, research, and reasoning workflows where the request may contain substantially more context than a typical chat prompt.

Kimi K3’s Novita model page describes a 2.8-trillion-parameter model with native visual understanding and a 1M-token context window. The same page lists text, image, and video inputs with text output, plus serverless access, structured output, reasoning, and function calling. Treat those as capabilities to verify against your intended request shape rather than assuming every OpenAI SDK feature has identical behavior across models.

This is not a benchmark comparison. The goal is to get one authenticated request working, then give you enough operational detail to decide whether Kimi K3 fits your workload.

Step 1: Get Your Novita API Key

Create or select a Novita AI account, open your API key settings, and create a key for server-side use. Keep the key out of frontend bundles, public repositories, notebooks shared outside your team, and shell history where possible.

Set the key as an environment variable before running either example:

export NOVITA_API_KEY="your_api_key_here"

Use a project or temporary key when your account setup supports it. Rotate the key after a public demo or any suspected exposure.

Step 2: Confirm the Model ID and Endpoint

Keep the connection details together so a display name does not accidentally replace the actual model identifier:

FieldValue
Model IDmoonshotai/kimi-k3
Base URLhttps://api.novita.ai/openai/v1
Chat completions endpointhttps://api.novita.ai/openai/v1/chat/completions
Context window1,048,576 tokens
Maximum output setting1,048,576 tokens
Input capabilitiesText, image, video
Output capabilityText
Access typeServerless API

The Kimi K3 model page is the source of truth for availability, current limits, capabilities, and pricing. Check it again before shipping because model configurations and prices can change.

Step 3: Send Your First Request

Start with a short text-only request. A small prompt makes it easier to separate authentication or routing problems from application-level prompt issues.

For example, ask Kimi K3 to return a short implementation checklist:

List the three biggest risks when adding retries to a streaming API client. Return one sentence per risk.

Keep the first max_tokens value modest. A large output allowance is useful only after the basic request, response parsing, and error handling work correctly.

Step 4: Read the Response

The OpenAI-compatible response places the assistant’s text at choices[0].message.content for a standard non-streaming chat completion. Preserve response metadata and usage fields in your application if you need request tracing or cost accounting.

For a production integration, record at least:

  • The model ID and request timestamp.
  • The provider request ID, when returned by the client or response headers.
  • Prompt and completion token usage.
  • Retry count and HTTP status.
  • Whether the request used text-only or multimodal content.

Once the first call succeeds, test prompts that resemble your real workload: long source files, several documents, a tool schema, or a structured response contract. A successful short prompt verifies connectivity, not production quality.

Step 5: Check Pricing, Limits, and Common Errors

The Novita model page lists serverless pricing of $3 per million input tokens, $0.30 per million cached-read tokens, and $15 per million output tokens for Kimi K3. Your estimate should include both sides of the request, retries, and the amount of context you send repeatedly.

The page also lists these request-rate tiers:

TierRequests per minuteTokens per minute
T13050,000,000
T210050,000,000
T31,00050,000,000
T43,00050,000,000
T56,00050,000,000

The applicable tier depends on your account. Do not treat the table as a promise that every project starts at T1 or that every workload can use the maximum displayed rate.

Common first-integration errors include:

  • Missing the Authorization: Bearer header or setting the wrong environment variable.
  • Sending kimi-k3 or a marketing name instead of moonshotai/kimi-k3.
  • Using https://api.novita.ai/openai as the SDK base URL when the client expects the versioned .../openai/v1 path.
  • Sending a request body that is not valid JSON.
  • Setting an output limit that is larger than your application can store or process.
  • Assuming a multimodal request body is identical across every SDK or model family.

Python Example

Install the OpenAI Python client in your environment, then run this example with NOVITA_API_KEY set:

pip install openai
import os

from openai import OpenAI


client = OpenAI(
    api_key=os.environ["NOVITA_API_KEY"],
    base_url="https://api.novita.ai/openai/v1",
)

response = client.chat.completions.create(
    model="moonshotai/kimi-k3",
    messages=[
        {
            "role": "system",
            "content": "You are a concise engineering assistant.",
        },
        {
            "role": "user",
            "content": "List three risks when adding retries to a streaming API client.",
        },
    ],
    temperature=0.2,
    max_tokens=300,
)

print(response.choices[0].message.content)

The example intentionally uses a short completion. Increase the context and output budgets only after you have added timeout, retry, logging, and usage tracking appropriate for your application.

cURL Example

The same request can be tested without an SDK:

payload='{
  "model": "moonshotai/kimi-k3",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise engineering assistant."
    },
    {
      "role": "user",
      "content": "List three risks when adding retries to a streaming API client."
    }
  ],
  "temperature": 0.2,
  "max_tokens": 300
}'

curl --request POST "https://api.novita.ai/openai/v1/chat/completions" \
  --header "Authorization: Bearer $NOVITA_API_KEY" \
  --header "Content-Type: application/json" \
  --data "$payload"

Key Parameters

ParameterWhat it controlsSensible first value
modelThe hosted model that answers the requestmoonshotai/kimi-k3
messagesSystem, user, and assistant conversation turnsOne system and one user message
temperatureOutput variability0.2 for repeatable tests
max_tokensMaximum generated output300, then raise it deliberately
streamWhether output arrives incrementallyLeave disabled while debugging
toolsFunction definitions available to the modelAdd after basic chat works
response_formatStructured output requirementsValidate the returned JSON before using it

For image or video inputs, confirm the current request format in the model and API documentation before adding them to your application. Capability labels on a model page do not replace testing the exact content structure used by your client library.

Troubleshooting

Authentication fails

Check that NOVITA_API_KEY is set in the same process that runs the request. Confirm that the header uses Bearer, not a query parameter or a different credential name.

The model is not found

Use the exact ID moonshotai/kimi-k3. The model display name is not a valid substitute for the API model ID.

The request is rejected

Reduce the prompt and max_tokens values, validate the JSON body, and confirm that the endpoint is /openai/v1/chat/completions. If the request uses images, video, tools, or structured output, remove those fields and add them back one at a time.

Requests are slow or rate-limited

Measure prompt and output token counts, reduce unnecessary repeated context, and add bounded exponential backoff for retryable responses. Check your account’s current rate tier rather than assuming the highest tier in the model-page table.

The response is incomplete

Inspect the finish reason and usage data. A small max_tokens value can stop a long answer early; increasing it also increases the amount of output your application may pay for and process.

FAQ

What model ID should I send for Kimi K3?

Send moonshotai/kimi-k3 in the model field.

Which endpoint does the OpenAI client use?

Set the SDK base URL to https://api.novita.ai/openai/v1. The chat completions request is sent to https://api.novita.ai/openai/v1/chat/completions.

How large is Kimi K3’s context window?

The Novita model page lists a 1,048,576-token context window and a 1,048,576-token maximum output setting. Check the page before deployment for updates.

Is Kimi K3 free to call?

No free-access claim is made here. The model page lists token-based serverless pricing, so check the current pricing shown for your account and model before sending large requests.

Should I start with a multimodal request?

No. Start with a small text-only request so authentication, endpoint selection, response parsing, and error handling are easy to verify. Add multimodal inputs after that path is stable.

Sources