Gumloop— the modern resource client used for chat completions, agents, sessions, MCP, skills, artifacts, and teams.GumloopClient— the legacy flows client used to start saved automations and poll for outputs. Emits aDeprecationWarningat construction.
Gumloop for new code. Use GumloopClient only if you need run_flow against an existing saved automation.
Installation
Chat completions
client.chat.completions.create(...) is an OpenAI-compatible chat surface that routes to every model Gumloop supports (Anthropic, OpenAI, Google Gemini, OpenRouter routes). The streaming variant returns an iterator of ChatStreamChunk; the unary variant returns a ChatResult.
Streaming
Structured output
Passresponse_format={"type": "json_schema", "json_schema": {...}} to constrain the response to a JSON Schema. The SDK accepts the same shape the OpenAI API documents.
Image generation
Request an image-generation model (gpt-image-*, gemini-*-image-preview, dall-e-*) with modalities=["image", "text"]. The response carries image attachments on choices[0].message.images as data URLs. Streaming variants emit partial frames natively for OpenAI gpt-image models.
Tool calling
Pass OpenAI-shape tool definitions; the SDK forwards them unchanged so any LLM that supports function calling can invoke them.Bring your own provider key
When the calling user has configured their own provider API key (OpenAI, Anthropic, etc.) in Gumloop, every completion they make is automatically charged at half the standard credit cost. No SDK change required — pricing is set server-side from the user’s account.MCP tools
client.mcp.execute(...) returns an McpExecuteResponse with one result per tool call. MCP execution failures, such as target server authentication errors or upstream connection failures, are reported on each result instead of being raised as APIStatusError. Gumloop request errors, such as missing credentials, invalid request bodies, or endpoint permission failures, can still raise APIStatusError.
decoded_content is a Python SDK convenience property. Raw REST responses include the underlying content array.
Flows (legacy client)
project_id when creating the client if running automations in a workspace:
