swarms chat
post_swarms-chatswarms chat Calls POST /api/swarms-chat on swarms.world with your API key.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"message": "<message>",
"systemPrompt": "<systemPrompt>",
"promptId": "<promptId>"
},
"name": "post_swarms-chat"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| img | No | One base64 image without the data: prefix | |
| imgs | No | Every attached base64 image. Non-string entries are dropped; sent only when non-empty. The web client sends both img and imgs | |
| model | No | One of gpt-5.4, claude-haiku-4-5-20251001, gemini-2.0-flash, gpt-5, gemini-2.5-pro, claude-4-opus-20250514, claude-4-sonnet-20250514, claude-haiku-4-5, claude-opus-4-1, claude-sonnet-4-5, xai/grok-4, xai/grok-4-fast-reasoning, xai/grok-4-fast-non-reasoning, xai/grok-4-latest, or any chat model the Swarms API lists at GET /v1/models/available (cached for an hour). An empty string falls back to the default | gpt-5.4 |
| history | No | Earlier turns, forwarded unchecked to the Swarms API. The web client sends an object keyed message1, message2, …; an empty object is dropped | |
| message | Yes | The user turn, sent to the Swarms API as `task` | |
| promptId | Yes | Id of the marketplace prompt being chatted with. Must be non-empty; not otherwise read or checked | |
| promptName | No | Agent name the model answers to. Blank falls back to "Agent". Must be a string: another type crashes the route with a 500 | Agent |
| systemPrompt | Yes | The prompt body. The route prefixes an identity block built from `promptName` / `promptDescription` and sends it as the agent system prompt | |
| agent_settings | No | Swarms AgentSpec overrides. When present, EVERY field is required (it is the full settings object the web client stores, not a partial); a failing object is a 400 with `issues`. Nulls and empty arrays are dropped, and agent_name, description, system_prompt, model_name, streaming_on and publish_to_marketplace are always set by the route. Without it the agent runs with max_tokens 32000, role worker, max_loops 1, reasoning_effort low | |
| search_enabled | No | Only the literal `true` enables web search. The agent then runs 2 loops and the whole reply arrives as one `chunk` event instead of token by token | |
| promptDescription | No | Agent description; also the agent `description` (falls back to the name). Must be a string: another type crashes the route |