Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

Inkling

テキスト生成 • thinkingmachines

Markdown で表示Agent セットアップ
  • サードパーティ

Inkling は、mixture-of-experts アーキテクチャを採用した Thinking Machines のオープンウェイトなハイブリッド推論モデルです。デフォルトで推論し、思考過程を先頭の thinking コンテンツブロックとして出力します。推論の強さは Tinker 固有の output_config.effort パラメータで調整できます。Tinker のベータ版 Anthropic Messages 互換エンドポイントで、ツール利用、ストリーミング、マルチターン会話とともに利用できます。現時点では高スループットの本番運用ではなく、低トラフィックのテストや内部利用を想定しています。このエンドポイントではプロンプトキャッシュ、引用、音声入力は非対応です。

モデル情報
コンテキストウィンドウ64,000 トークン
詳細情報リンク
リクエスト形式Anthropic Messages
料金Cloudflare ダッシュボードで料金を見る

使い方

const response = await env.AI.run(
  'thinkingmachines/inkling',
  { max_tokens: 512, messages: [{ content: 'The capital of France is', role: 'user' }] },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/messages \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "thinkingmachines/inkling",
  "max_tokens": 512,
  "messages": [
    {
      "content": "The capital of France is",
      "role": "user"
    }
  ]
}'
Paris.
{
  "id": "msg_922ec1780752447c802ec60be3dabfd6",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "thinking",
      "thinking": "The user is asking a simple factual question: \"The capital of France is\". The answer is Paris. I should provide the answer clearly and concisely.",
      "signature": ""
    },
    {
      "type": "text",
      "text": "Paris."
    }
  ],
  "model": "thinkingmachines/Inkling",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 41,
    "cache_creation_input_tokens": 19,
    "cache_read_input_tokens": 0
  }
}

ツール利用 — ツール利用の往復です。モデルがツール呼び出しを要求し、後続のユーザーメッセージで渡した `tool_result` を使って回答します
const response = await env.AI.run(
  'thinkingmachines/inkling',
  {
    max_tokens: 1024,
    messages: [
      { content: "What's the weather in Paris?", role: 'user' },
      {
        content: [
          {
            id: 'toolu_01A1x1x1x1x1x1x1x1x1x1x1',
            input: { city: 'Paris' },
            name: 'get_weather',
            type: 'tool_use',
          },
        ],
        role: 'assistant',
      },
      {
        content: [
          {
            content: 'Sunny, 22°C',
            tool_use_id: 'toolu_01A1x1x1x1x1x1x1x1x1x1x1',
            type: 'tool_result',
          },
        ],
        role: 'user',
      },
    ],
    tools: [
      {
        description: 'Get the current weather for a city.',
        input_schema: {
          properties: { city: { type: 'string' } },
          required: ['city'],
          type: 'object',
        },
        name: 'get_weather',
      },
    ],
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/messages \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "thinkingmachines/inkling",
  "max_tokens": 1024,
  "messages": [
    {
      "content": "What'\''s the weather in Paris?",
      "role": "user"
    },
    {
      "content": [
        {
          "id": "toolu_01A1x1x1x1x1x1x1x1x1x1x1",
          "input": {
            "city": "Paris"
          },
          "name": "get_weather",
          "type": "tool_use"
        }
      ],
      "role": "assistant"
    },
    {
      "content": [
        {
          "content": "Sunny, 22°C",
          "tool_use_id": "toolu_01A1x1x1x1x1x1x1x1x1x1x1",
          "type": "tool_result"
        }
      ],
      "role": "user"
    }
  ],
  "tools": [
    {
      "description": "Get the current weather for a city.",
      "input_schema": {
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "type": "object"
      },
      "name": "get_weather"
    }
  ]
}'
The weather in Paris is sunny with a temperature of 22°C. Enjoy the nice weather!
{
  "id": "msg_ddfc346862fc4a3f8afc1f8f53e1d932",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "thinking",
      "thinking": "The user asked for the weather in Paris and the function returned \"Sunny, 22°C\". I should provide a clear, friendly answer with this information.",
      "signature": ""
    },
    {
      "type": "text",
      "text": "The weather in Paris is sunny with a temperature of 22°C. Enjoy the nice weather!"
    }
  ],
  "model": "thinkingmachines/Inkling",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 57,
    "cache_creation_input_tokens": 95,
    "cache_read_input_tokens": 0
  }
}
拡張思考 — Tinker の `output_config.effort` 拡張で推論の強さを制御します。モデルの思考過程は、回答の前の先頭 thinking コンテンツブロックとして返されます。
const response = await env.AI.run(
  'thinkingmachines/inkling',
  {
    max_tokens: 1024,
    messages: [{ content: 'What is 17 * 23?', role: 'user' }],
    output_config: { effort: 'high' },
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/messages \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "thinkingmachines/inkling",
  "max_tokens": 1024,
  "messages": [
    {
      "content": "What is 17 * 23?",
      "role": "user"
    }
  ],
  "output_config": {
    "effort": "high"
  }
}'
17 × 23 = **391**

(Breakdown: 17 × 20 = 340, plus 17 × 3 = 51; 340 + 51 = 391)
{
  "id": "msg_a7e845f498bd44e9b1d63dca8b104a2e",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "thinking",
      "thinking": "The user is asking for the product of 17 and 23. Let me calculate that.\n\n17 * 23 = ?\n\nI can compute this as:\n17 * 20 = 340\n17 * 3 = 51\n340 + 51 = 391\n\nAlternatively:\n17 * 23 = 17 * (25 - 2) = 425 - 34 = 391\nOr (20 - 3) * 23 = 460 - 69 = 391\n\nSo the answer is 391.",
      "signature": ""
    },
    {
      "type": "text",
      "text": "17 × 23 = **391**\n\n(Breakdown: 17 × 20 = 340, plus 17 × 3 = 51; 340 + 51 = 391)"
    }
  ],
  "model": "thinkingmachines/Inkling",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 155,
    "cache_creation_input_tokens": 22,
    "cache_read_input_tokens": 0
  }
}

パラメーター

max_tokens
number必須exclusiveMinimum: 0
system
string
temperature
numberminimum: 0maximum: 1
top_p
numberminimum: 0maximum: 1
top_k
numberexclusiveMinimum: 0
stream
boolean
id
string
type
stringconst: message
role
stringconst: assistant
model
string
stop_reason
string | null

API スキーマ(Raw)

Input
Output

役に立ちましたか?