DeepAnima
Kouri Ai

API Overview

Kouri Ai API basics and usage guide

Kouri Ai provides API services fully compatible with OpenAI API format, while also supporting Anthropic, Gemini and other protocols, allowing you to easily call dozens of flagship models including GPT, Claude, Gemini, DeepSeek, and more.

Endpoints

OpenAI Compatible Endpoints

Endpoint TypeURLDescription
Chat Completionshttps://api.kourichat.com/v1/chat/completionsChat completion API, for most models
Responseshttps://api.kourichat.com/v1/responsesResponse API, required for reasoning models
Standard Endpointhttps://api.kourichat.com/v1Recommended for SDKs
Base Endpointhttps://api.kourichat.comFor some applications

Important: Some models like gpt-5.2-pro and o3-pro only support the Response API, not Chat Completions. Please choose the correct API based on model requirements.

Other Protocol Endpoints

ProtocolEndpoint URLDescription
Anthropic Protocolhttps://api.kourichat.com/v1/messagesClaude native protocol
Gemini Protocolhttps://api.kourichat.com/v1betaGemini native protocol

Model Compatibility: Both Anthropic and Gemini protocol endpoints support calling all models (not limited to Claude or Gemini), while the OpenAI protocol's Responses endpoint only supports specific reasoning models.

Authentication

All API requests require authentication via API token. You can create and manage tokens in the Console.

HTTP Header Authentication

Add the Authorization header to your request:

Authorization: Bearer sk-xxxxxxxxxxxxxxxx

Complete Request Example

curl https://api.kourichat.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Security Notice: Keep your API token safe. Never expose it in client-side code, public repositories, or logs.

Request Format

All API requests use JSON format:

  • Content-Type: application/json
  • Method: POST (chat endpoints), GET (query endpoints)

Basic Request Structure

{
  "model": "model-name",
  "messages": [
    {"role": "system", "content": "System prompt"},
    {"role": "user", "content": "User message"}
  ],
  "temperature": 0.7,
  "max_tokens": 2048,
  "stream": false
}

Common Parameters

ParameterTypeRequiredDescription
modelstringModel name, e.g., gpt-4o, claude-sonnet-4-20250514
messagesarrayMessage list with roles and content
temperaturenumberRandomness, 0-2, default 1
max_tokensintegerMaximum output tokens
streambooleanEnable streaming, default false
top_pnumberNucleus sampling, 0-1

Response Format

Standard Response

{
  "id": "chatcmpl-xxxxxxxx",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 15,
    "total_tokens": 25
  }
}

Streaming Response

With stream: true, responses are returned as Server-Sent Events (SSE):

data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"Hello"},"index":0}]}

data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"!"},"index":0}]}

data: [DONE]

Error Codes

HTTP StatusError TypeDescription
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing token
403ForbiddenAccess denied
404Not FoundEndpoint or model not found
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error
503Service UnavailableService temporarily unavailable

Error Response Example

{
  "error": {
    "message": "Invalid API key provided",
    "type": "invalid_request_error",
    "code": "invalid_api_key"
  }
}

Universal Model Access

Kouri Ai provides universal model access, allowing you to call all chat models through the standard ChatCompletion endpoint, including:

  • OpenAI Series: GPT-4o, GPT-4, o1, o3, etc.
  • Anthropic Series: Claude Sonnet, Claude Opus, etc.
  • Google Series: Gemini 2.5 Flash, Gemini 2.5 Pro, etc.
  • Other Models: DeepSeek, Qwen, etc.

Kouri Ai handles protocol conversion automatically. You can use /v1/chat/completions to call all models without worrying about underlying protocol differences.

Rate Limits

  • Request Rate: Varies by token type and account level
  • Request Timeout: 5 minutes for normal requests, longer for complex reasoning
  • Max Message Length: Depends on the model's context window

For higher quotas, please contact support for enterprise plans.

On this page