Quickstart
Install the SDK, create a session, and execute your first commerce tool call in under 5 minutes.
Install the SDK
Pick your framework and install the matching adapter:
Configure your API key
Set your CodeSpar API key in your environment:
Get your key from the dashboard. Keys start with csk_live_ for production or csk_test_ for testing.
Create a session
A session scopes tools, auth, and billing to a user. Create one per user interaction:
Execute a tool call
Call a commerce tool directly:
Every tool call is logged on the backend with input, output, and duration — the billing unit for metered plans.
Use with your AI framework
Pass CodeSpar tools to your preferred AI framework. Here's Claude:
See the full provider guides: Claude · OpenAI · Vercel AI SDK
Try the Sandbox
Don't want to write code yet? Try the Sandbox — a playground where you can chat with a commerce agent and see tool calls execute in real time. Type "Charge R$500 via Pix and issue the NF-e" to see the Complete Loop in action.