Get started
Quickstart
You need a morigraph account with credits. A new account starts with free credits, so you can try this before paying. Create an account.
1. Get a key
In the dashboard. Open Developers, name a key and create it. Copy it straight away: it is shown once. Only a workspace admin can create keys, because a key spends the workspace's shared credits.
Or from a terminal. This prints a code, opens the dashboard, and stores the key once an admin approves:
npx @morigraph/cli@latest login
Keep the key in an environment variable, never in source control:
export MORIGRAPH_API_KEY=mg_sk_live_...
2. Check it works
This costs nothing:
curl https://api.morigraph.com/v1/me \
-H "Authorization: Bearer $MORIGRAPH_API_KEY"
3. See what you can call
curl https://api.morigraph.com/v1/tools \
-H "Authorization: Bearer $MORIGRAPH_API_KEY"
Each tool comes with its price in credits and a JSON Schema for its arguments.
4. Call a tool
The request body is the tool's arguments.
curl https://api.morigraph.com/v1/tools/web_search \
-H "Authorization: Bearer $MORIGRAPH_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"query": "best practices for rate limiting an API", "num_results": 3}'
{
"request_id": "4a1c...",
"tool": "web_search",
"status": "completed",
"output": { "text": "1. ...", "data": null },
"job": null,
"credits": { "charged": 0.14, "reserved": 0, "remaining": 4.86 }
}
output.text is the answer. output.data carries the same facts as JSON when the tool provides them, for example the URL of a generated image. credits.charged is what this call cost.
The same call from the command line:
morigraph call web_search --arg query="best practices for rate limiting an API" --arg num_results=3
5. Longer jobs
Video generation takes minutes. The call answers at once with HTTP 202 and a job, and you check the job until it is done. Checking is free.
curl https://api.morigraph.com/v1/jobs/JOB_ID \
-H "Authorization: Bearer $MORIGRAPH_API_KEY"
From the command line, --wait does the checking for you:
morigraph call video_gen --json-args '{"prompt": "a paper boat on a calm lake"}' --wait
Next
- Giving this to a coding agent? Point it at For AI agents.
- Tools lists every argument.
- Errors and limits says what each failure means and what to do.