{"slug": "crusoe-is-now-a-pydantic-ai-model-provider", "title": "Crusoe is now a Pydantic AI model provider", "summary": "Crusoe is now a native model provider in Pydantic AI, enabling developers to run agents on Crusoe Managed Inference with a single string like 'crusoe:zai/GLM-5.2'. The integration, contributed upstream to the pydantic-ai repository, provides streaming, tool calling, structured output, and per-family model profiles for open models including GLM, Llama, DeepSeek, Qwen, Gemma, gpt-oss, Kimi, and NVIDIA Nemotron 3. Emmanuel Acheampong, Senior Developer Relations Manager at Crusoe, and Laís Carvalho, Developer Relations at Pydantic, co-authored the announcement.", "body_md": "_The following is a guest post from [Crusoe](https://crusoe.ai/), written by [Emmanuel Acheampong](https://www.linkedin.com/in/emmanuel-acheampong/), Senior Developer Relations Manager. Co-authored by [Laís Carvalho](https://www.linkedin.com/in/laisbsc/), Developer Relations at Pydantic.\n\nCrusoe is now a native model provider in [Pydantic AI](https://pydantic.dev/docs/ai/overview/). One string, `'crusoe:zai/GLM-5.2'`\n\n, and your agents run on Crusoe Managed Inference: streaming, tool calling, structured output, and the full open model catalog on the Crusoe Intelligence Foundry, all out of the box.\n\nThis post covers who we are, why we built the integration, and how to use it.\n\nWhy we built this\n\nCrusoe is the cloud for AI, however you build it. Open models are a fast-growing part of that picture, and they deserve infrastructure built for them. Crusoe Managed Inference serves the open catalog end to end on the Crusoe Intelligence Foundry: GLM, Llama, DeepSeek, Qwen, Gemma, gpt-oss, Kimi, and the NVIDIA Nemotron™ 3 family, with day-zero support for new releases.\n\nServing open weights is half of that work. The other half is meeting developers in the open source tools they already use. Crusoe is an upstream provider in LiteLLM and now a native Pydantic AI provider. Each integration follows the same principle: contribute the code upstream, keep it maintained, and let the framework's own conventions handle configuration.\n\nNothing in this stack locks you in. The models are open weights, the frameworks are open source, and the provider described in this post lives in the [pydantic-ai repository](https://github.com/pydantic/pydantic-ai), not in a Crusoe SDK. The ecosystem gets stronger when open and closed keep pushing each other forward, and builders match each workload to the right model. That is the outcome we are investing in.\n\nThe problem\n\nPlenty of teams were already running Pydantic AI agents against Crusoe. It worked, but it meant wiring up `OpenAIProvider`\n\nwith a custom `base_url`\n\n, managing the API key by hand, and losing model profile inference along the way. Model profiles matter more than they sound: they tell Pydantic AI how each model family handles JSON schemas, tool definitions, and output formats. Point a generic OpenAI provider at a GLM or gpt-oss model and you get OpenAI defaults, which are not always the right ones.\n\nA native provider removes all of that. The endpoint, the key handling, and the per-family profiles ship in the framework.\n\nHow it works\n\nThe integration adds a `CrusoeProvider`\n\nto `pydantic-ai`\n\n, following the same pattern as other OpenAI-compatible providers. Install Pydantic AI, or the slim package with the `openai`\n\ngroup:\n\n```\nuv add logfire \"pydantic-ai-slim[openai]\"\n```\n\nGenerate a key in the [Crusoe Cloud console](https://console.crusoecloud.com/) under Intelligence Foundry, then set it:\n\n```\nexport CRUSOE_API_KEY=\"cr_...\"\n```\n\nThat is the whole setup. The shorthand string does the rest:\n\n``` python\nimport logfire\nfrom pydantic_ai import Agent\n\nlogfire.configure()\nlogfire.instrument_pydantic_ai()\n\nagent = Agent('crusoe:zai/GLM-5.2')\nresult = agent.run_sync('In one sentence: why do open agent stacks matter in 2026?')\n\nprint(result.output)\n```\n\nStructured output works the way you would expect from Pydantic AI, because the provider infers the right profile for the model family:\n\n``` python\nimport logfire\nfrom pydantic import BaseModel\nfrom pydantic_ai import Agent\n\nlogfire.configure()\nlogfire.instrument_pydantic_ai()\n\nclass GpuSpec(BaseModel):\n    name: str\n    memory_gb: int\n    interconnect: str\n\nagent = Agent('crusoe:zai/GLM-5.2', output_type=GpuSpec)\nresult = agent.run_sync('Summarize the NVIDIA HGX™ B200 as a spec.')\n\nprint(result.output)\n#> name='NVIDIA HGX B200' memory_gb=1536 interconnect='5th-Gen NVLink (1.8 TB/s per GPU), PCIe Gen5'\n```\n\nIf you need explicit control, construct the provider yourself:\n\n``` python\nimport logfire\nfrom pydantic_ai import Agent\nfrom pydantic_ai.models.openai import OpenAIChatModel\nfrom pydantic_ai.providers.crusoe import CrusoeProvider\n\nlogfire.configure()\nlogfire.instrument_pydantic_ai()\n\nmodel = OpenAIChatModel(\n    'meta-llama/Llama-3.3-70B-Instruct',\n    provider=CrusoeProvider(api_key='your-api-key'),\n)\n\nagent = Agent(model)\nresult = agent.run_sync('Be concise. Defend the Oxford comma.')\nprint(result.output)\n```\n\nThe provider also accepts a custom `httpx.AsyncClient`\n\nor a preconfigured `AsyncOpenAI`\n\nclient, so it fits whatever connection pooling or proxy setup you already run.\n\nUnder the hood, `CrusoeProvider`\n\nmaps the supported model families to their correct Pydantic AI profiles: `meta-llama`\n\n, `deepseek-ai`\n\n, `qwen`\n\n, `google`\n\n(Gemma), `moonshotai`\n\n(Kimi), `zai`\n\n(GLM), and `openai`\n\n(gpt-oss, which uses the harmony profile). Tool schemas and JSON output behave correctly per family without any configuration on your side. Families without an explicit profile fall back to OpenAI-compatible defaults.\n\nResults and learnings\n\nWhat you get from the pairing is a short list with a lot behind it. Pydantic AI brings the agent framework: type-safe outputs, tools, streaming, and evals through Pydantic Evals, with tracing through Pydantic [Logfire](/logfire). Crusoe brings the inference layer built for agent workloads. MemoryAlloy, our cluster-wide KV cache fabric, routes requests cache-aware, which matters for agents that re-send system prompts and accumulated history on every turn. Cached input pricing means the loop stays cheap as contexts grow.\n\nThe main learning from building the provider: the OpenAI-compatible pattern in Pydantic AI is well factored. The whole integration is one provider class, a profile map, and tests that mirror the existing Nebius provider. If you serve open models behind an OpenAI-compatible endpoint, contributing a provider is a weekend project, and the maintainers' review process makes the result better than what you started with.\n\nTry it\n\nTwo steps: grab a key from the [Intelligence Foundry](https://console.crusoecloud.com/request-foundry), then `uv add logfire \"pydantic-ai-slim[openai]\"`\n\nand point an `Agent`\n\nat `crusoe:`\n\nplus any model in the [catalog](https://docs.crusoecloud.com/managed-inference/overview/).\n\nOnce that first agent runs:\n\n- The\n[Pydantic AI documentation](https://pydantic.dev/docs/ai/overview/)covers what comes after a single`run_sync`\n\n: tools, streaming, dependency injection, and multi-agent flows. - Every example above calls\n`logfire.configure()`\n\n. That is[Pydantic Logfire](https://pydantic.dev/logfire), and it turns each run into a trace you can open: model calls, tool calls, retries, and token costs, queryable with SQL. The[Pydantic AI integration docs](https://pydantic.dev/docs/logfire/integrations/llms/pydanticai/)cover the setup, and the free tier is enough to watch your first agents work. [Pydantic Evals](https://pydantic.dev/docs/ai/evals/evals/)is worth reaching for when you start swapping models in the catalog and need to know whether the swap made things better.\n\nIf you build something interesting on this stack, we would love to hear about it. Reach the Crusoe developer community at [devcommunity@crusoe.ai](mailto:devcommunity@crusoe.ai), and follow [Crusoe for Developers on LinkedIn](https://www.linkedin.com/showcase/crusoedev/) and [@crusoedev on X](https://x.com/crusoedev) for model launches, cookbook drops, and more walkthroughs.\n\nAn agent framework with validation at its core, and inference built for agents underneath it. That is the stack we wanted to use ourselves, so we wired it in.", "url": "https://wpnews.pro/news/crusoe-is-now-a-pydantic-ai-model-provider", "canonical_source": "https://pydantic.dev/articles/crusoe-pydantic-ai-model-provider", "published_at": "2026-08-14 09:00:00+00:00", "updated_at": "2026-08-14 12:38:22.695409+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "generative-ai"], "entities": ["Crusoe", "Pydantic AI", "Emmanuel Acheampong", "Laís Carvalho", "GLM-5.2", "NVIDIA Nemotron 3", "LiteLLM", "Crusoe Intelligence Foundry"], "alternates": {"html": "https://wpnews.pro/news/crusoe-is-now-a-pydantic-ai-model-provider", "markdown": "https://wpnews.pro/news/crusoe-is-now-a-pydantic-ai-model-provider.md", "text": "https://wpnews.pro/news/crusoe-is-now-a-pydantic-ai-model-provider.txt", "jsonld": "https://wpnews.pro/news/crusoe-is-now-a-pydantic-ai-model-provider.jsonld"}}