Muse Spark 1.2

Text Generation • Meta

meta/muse-spark-1.2

  • Third-party

Muse Spark 1.2 is Meta's agentic and coding model for multi-step tool loops, software engineering assistants, and long-context reasoning.

Model Info
More information link ↗
Request formats Responses
Pricing <ul><li>Input (per 1M tokens)$1.25</li><li>Cached input (per 1M tokens)$0.16</li><li>Output (per 1M tokens)$4.25</li></ul>

Usage

const response = await env.AI.run(
  'meta/muse-spark-1.2',
  {
    messages: [
      {
        role: 'user',
        content:
          'I am planning an outdoor dinner in Lisbon tonight. Check the weather and then give me a one-sentence recommendation.',
      },
      {
        role: 'assistant',
        content: null,
        tool_calls: [
          {
            id: 'call_weather_lisbon',
            type: 'function',
            function: { name: 'get_weather', arguments: '{"city":"Lisbon"}' },
          },
        ],
      },
      {
        role: 'tool',
        content: '22 C, partly cloudy, 10 percent chance of rain, light wind',
        tool_call_id: 'call_weather_lisbon',
      },
    ],
    tools: [
      {
        type: 'function',
        function: {
          name: 'get_weather',
          description: 'Get the current weather and short-term forecast for a city.',
          parameters: {
            type: 'object',
            properties: { city: { type: 'string', description: 'City name' } },
            required: ['city'],
          },
        },
      },
    ],
    max_completion_tokens: 800,
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "meta/muse-spark-1.2",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": "I am planning an outdoor dinner in Lisbon tonight. Check the weather and then give me a one-sentence recommendation."
      },
      {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_weather_lisbon",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"city\":\"Lisbon\"}"
            }
          }
        ]
      },
      {
        "role": "tool",
        "content": "22 C, partly cloudy, 10 percent chance of rain, light wind",
        "tool_call_id": "call_weather_lisbon"
      }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get the current weather and short-term forecast for a city.",
          "parameters": {
            "type": "object",
            "properties": {
              "city": {
                "type": "string",
                "description": "City name"
              }
            },
            "required": [
              "city"
            ]
          }
        }
      }
    ],
    "max_completion_tokens": 800
  }
}'

Examples

<details>

<summary>Currency Conversion Tool Round Trip — Complete a currency-conversion tool round trip and report the result with the supplied rate and timestamp.</summary>

const response = await env.AI.run(
  'meta/muse-spark-1.2',
  {
    messages: [
      {
        role: 'user',
        content:
          'Convert a 125 EUR invoice to USD and tell me whether it exceeds a 130 USD approval threshold.',
      },
      {
        role: 'assistant',
        content: null,
        tool_calls: [
          {
            id: 'call_fx_invoice',
            type: 'function',
            function: { name: 'get_exchange_rate', arguments: '{"base":"EUR","quote":"USD"}' },
          },
        ],
      },
      {
        role: 'tool',
        content: '{"rate":1.09,"as_of":"2026-10-06T12:00:00Z"}',
        tool_call_id: 'call_fx_invoice',
      },
    ],
    tools: [
      {
        type: 'function',
        function: {
          name: 'get_exchange_rate',
          description: 'Return the current exchange rate between two currencies.',
          parameters: {
            type: 'object',
            properties: { base: { type: 'string' }, quote: { type: 'string' } },
            required: ['base', 'quote'],
          },
        },
      },
    ],
    max_completion_tokens: 1200,
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "meta/muse-spark-1.2",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": "Convert a 125 EUR invoice to USD and tell me whether it exceeds a 130 USD approval threshold."
      },
      {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_fx_invoice",
            "type": "function",
            "function": {
              "name": "get_exchange_rate",
              "arguments": "{\"base\":\"EUR\",\"quote\":\"USD\"}"
            }
          }
        ]
      },
      {
        "role": "tool",
        "content": "{\"rate\":1.09,\"as_of\":\"2026-10-06T12:00:00Z\"}",
        "tool_call_id": "call_fx_invoice"
      }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_exchange_rate",
          "description": "Return the current exchange rate between two currencies.",
          "parameters": {
            "type": "object",
            "properties": {
              "base": {
                "type": "string"
              },
              "quote": {
                "type": "string"
              }
            },
            "required": [
              "base",
              "quote"
            ]
          }
        }
      }
    ],
    "max_completion_tokens": 1200
  }
}'
125 EUR = **~136.25 USD** at the current rate of 1 EUR = 1.09 USD (as of 2026-10-06T12:00:00Z).

Calculation: 125 * 1.09 = 136.25

**Yes, it exceeds the 130 USD approval threshold** by approximately 6.25 USD and would require approval.
{
  "id": "resp_6ac7b04ba509d24598194b61",
  "object": "response",
  "created_at": 1791471690,
  "model": "muse-spark-1.2",
  "output": [
    {
      "type": "reasoning",
      "id": "rs_6ac7b04ba509d24598194b61:rs_f4b0a6f3-023e-4c06-a3e4-10004d9ca24d",
      "summary": [],
      "status": "completed"
    },
    {
      "type": "message",
      "id": "msg_7d979f31-94ee-4666-b03e-a5e4a0c61fcc",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "125 EUR = **~136.25 USD** at the current rate of 1 EUR = 1.09 USD (as of 2026-10-06T12:00:00Z).\n\nCalculation: 125 * 1.09 = 136.25\n\n**Yes, it exceeds the 130 USD approval threshold** by approximately 6.25 USD and would require approval.",
          "annotations": [],
          "logprobs": []
        }
      ],
      "status": "completed"
    }
  ],
  "status": "completed",
  "usage": {
    "input_tokens": 679,
    "output_tokens": 362,
    "total_tokens": 1041,
    "input_tokens_details": {
      "cached_tokens": 113
    },
    "output_tokens_details": {
      "reasoning_tokens": 271
    }
  },
  "top_logprobs": 0,
  "temperature": 1,
  "top_p": 1,
  "service_tier": "auto",
  "reasoning": {
    "effort": "high"
  },
  "background": false,
  "tools": [
    {
      "type": "function",
      "name": "get_exchange_rate",
      "description": "Return the current exchange rate between two currencies.",
      "parameters": {
        "properties": {
          "base": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          }
        },
        "required": [
          "base",
          "quote"
        ],
        "type": "object"
      }
    }
  ],
  "tool_choice": "auto",
  "truncation": "disabled",
  "completed_at": 1791471691,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "parallel_tool_calls": true,
  "store": true,
  "max_output_tokens": 1200
}

</details>

<details>

<summary>Meeting Action Register — Extract decisions, owners, and follow-up dates from an unstructured project meeting transcript.</summary>

const response = await env.AI.run(
  'meta/muse-spark-1.2',
  {
    messages: [
      {
        role: 'system',
        content:
          'You are a precise project coordinator. Do not invent owners or dates. Mark missing information as unassigned or unspecified.',
      },
      {
        role: 'user',
        content:
          "Extract a concise action register from this transcript:\n\nMaya: We will ship the billing retry change after the staging soak.\nJon: I can own the dashboard, but I need the final event names from Priya.\nPriya: I will send those by Thursday.\nMaya: Let's review staging results Friday morning; if error rate stays below 0.5%, release Monday.\nJon: I will also add a rollback link to the runbook.\n\nReturn a table with action, owner, due date, and dependency, followed by the release criteria.",
      },
    ],
    max_completion_tokens: 1600,
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "meta/muse-spark-1.2",
  "input": {
    "messages": [
      {
        "role": "system",
        "content": "You are a precise project coordinator. Do not invent owners or dates. Mark missing information as unassigned or unspecified."
      },
      {
        "role": "user",
        "content": "Extract a concise action register from this transcript:\n\nMaya: We will ship the billing retry change after the staging soak.\nJon: I can own the dashboard, but I need the final event names from Priya.\nPriya: I will send those by Thursday.\nMaya: Let'\''s review staging results Friday morning; if error rate stays below 0.5%, release Monday.\nJon: I will also add a rollback link to the runbook.\n\nReturn a table with action, owner, due date, and dependency, followed by the release criteria."
      }
    ],
    "max_completion_tokens": 1600
  }
}'
Based on transcript only - no assumptions made:

| Action | Owner | Due Date | Dependency |
| :--- | :--- | :--- | :--- |
| Ship billing retry change | Unassigned | Unspecified | Staging soak completion |
| Own/build dashboard | Jon | Unspecified | Final event names from Priya |
| Send final event names | Priya | Thursday | Unspecified |
| Review staging results | Unassigned (proposed by Maya) | Friday morning | Staging results available |
| Add rollback link to runbook | Jon | Unspecified | Unspecified |

**Release Criteria:**
Error rate stays below 0.5% during staging soak, to be reviewed Friday morning. If criteria is met, release Monday.
{
  "id": "resp_6ac7b05469fb209135cc4a09",
  "object": "response",
  "created_at": 1791471700,
  "model": "muse-spark-1.2",
  "output": [
    {
      "type": "reasoning",
      "id": "rs_6ac7b05469fb209135cc4a09:rs_ab4bc0f0-3e37-48bf-92b6-2ddb16697c16",
      "summary": [],
      "status": "completed"
    },
    {
      "type": "message",
      "id": "msg_1062dd18-3e14-4f69-ad99-c9e552a4698c",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Based on transcript only - no assumptions made:\n\n| Action | Owner | Due Date | Dependency |\n| :--- | :--- | :--- | :--- |\n| Ship billing retry change | Unassigned | Unspecified | Staging soak completion |\n| Own/build dashboard | Jon | Unspecified | Final event names from Priya |\n| Send final event names | Priya | Thursday | Unspecified |\n| Review staging results | Unassigned (proposed by Maya) | Friday morning | Staging results available |\n| Add rollback link to runbook | Jon | Unspecified | Unspecified |\n\n**Release Criteria:**\nError rate stays below 0.5% during staging soak, to be reviewed Friday morning. If criteria is met, release Monday.",
          "annotations": [],
          "logprobs": []
        }
      ],
      "status": "completed"
    }
  ],
  "status": "completed",
  "usage": {
    "input_tokens": 158,
    "output_tokens": 2323,
    "total_tokens": 2481,
    "input_tokens_details": {
      "cached_tokens": 113
    },
    "output_tokens_details": {
      "reasoning_tokens": 2168
    }
  },
  "top_logprobs": 0,
  "temperature": 1,
  "top_p": 1,
  "service_tier": "auto",
  "reasoning": {
    "effort": "high"
  },
  "background": false,
  "tools": [],
  "tool_choice": "auto",
  "truncation": "disabled",
  "completed_at": 1791471700,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "parallel_tool_calls": true,
  "store": true,
  "max_output_tokens": 4096
}

</details>

<details>

<summary>Event Processing Trade-offs — Explain a distributed-systems trade-off to an engineering team and recommend an approach for the stated workload.</summary>

const response = await env.AI.run(
  'meta/muse-spark-1.2',
  {
    messages: [
      {
        role: 'user',
        content:
          'We need to process 50,000 events per second, preserve per-customer ordering, tolerate consumer restarts, and replay events for up to seven days. Compare partitioned logs with a task queue in a decision table covering ordering, throughput, retries, replay, and operations. Then recommend one approach and name its main failure mode. Keep it under 600 words.',
      },
    ],
    max_completion_tokens: 1800,
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "meta/muse-spark-1.2",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": "We need to process 50,000 events per second, preserve per-customer ordering, tolerate consumer restarts, and replay events for up to seven days. Compare partitioned logs with a task queue in a decision table covering ordering, throughput, retries, replay, and operations. Then recommend one approach and name its main failure mode. Keep it under 600 words."
      }
    ],
    "max_completion_tokens": 1800
  }
}'

``` For 50k events/sec with strict ordering + replay, Partitioned Log is the correct pattern.

Decision Table: Partitioned Log vs Task Queue

Criteria Partitioned Log Kafka / Redpanda / Kinesis Task Queue SQS / RabbitMQ / Celery / Sidekiq
Ordering Strong per-key ordering. Partition key = customer_id guarantees all events for one customer go to one ordered partition. Total order not guaranteed, but per-customer order is. Weak / No ordering. Most queues provide best-effort FIFO per-queue, but scaling with multiple consumers breaks ordering. Requires one queue per customer to guarantee order - not feasible.
Throughput High & Horizontally Scalable. 50k/sec is easily handled by adding partitions and brokers. Sequential disk I/O. Consumers scale with partition count. Limited by broker/acknowledgement overhead. High throughput requires many queues/workers. Contention on central broker, prefetch limits and per-message ACKs reduce throughput at 50k/sec.
Retries At-least-once, consumer-managed. Offset not committed until processed. On restart, consumer resumes from last committed offset. Requires idempotent consumer + Dead Letter Topic for poison pills to avoid blocking partition. Built-in ACK/NACK & retries. Failed job NACKs and is retried/requeued automatically. Easy per-message retry with visibility timeout / backoff. Risk of duplicate execution if worker crashes after processing but before ACK.
Replay Native, for retention window. Log is durable and immutable. Any consumer can rewind offset and replay last 7 days by configuration retention.ms=7 days. Ideal for new consumers, debugging, and reprocessing. No replay. Once ACKed, message is deleted. Requires separate archival DB to rebuild history. Cannot replay 7 days without custom infrastructure.
Operations Higher operational cost. Must manage brokers, partitions, replication, consumer rebalancing, schema registry, and monitor consumer lag. Partition count is hard to change and hot customers create skew. Lower operational cost. Fully managed services SQS are simple. No partitions/rebalancing to manage. Monitoring is queue depth.

Recommendation: Partitioned Log

A Task Queue cannot meet two core requirements: per-customer ordering at scale and 7-day replay. It is designed for distribution of work, not ordered event history.

A Partitioned Log is designed for this exact workload. Partition by customer_id to preserve ordering, scale consumers via a consumer group 1 consumer per partition, set retention to 7 days, and use committed offsets to tolerate restarts.

Main Failure Mode to Design For