Skip to main content
POST
/
ai
/
run
/
Run a metered AI action
curl --request POST \
  --url https://earthcare.network/api/v1/ai/run/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "feature": "outreach_draft",
  "model": "anthropic/claude-haiku",
  "messages": [
    {
      "content": "<string>"
    }
  ],
  "provider": "openrouter",
  "max_tokens": 1024,
  "temperature": 0.7,
  "max_credits": "<string>"
}
'
{
  "content": "<string>",
  "usage_event_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "credits": "<string>",
  "input_tokens": 123,
  "output_tokens": 123,
  "model": "<string>",
  "provider": "<string>"
}

Authorizations

Authorization
string
header
required

DRF user token. Format: Token <token>

Body

application/json
organization_id
string<uuid>
required
feature
string
required
Example:

"outreach_draft"

model
string
required
Example:

"anthropic/claude-haiku"

messages
object[]
required
provider
string
Example:

"openrouter"

max_tokens
integer
default:1024
Required range: 1 <= x <= 128000
temperature
number
default:0.7
Required range: 0 <= x <= 2
max_credits
string | null

Per-action cap override

Response

Result + metering

content
string
usage_event_id
string<uuid>
credits
string
input_tokens
integer
output_tokens
integer
model
string
provider
string