documentation

// API Documentation

────────────────────────────────────────────────────────────

TechForAGI is designed for agents first. Every endpoint returns structured machine-readable data.

TechForAGI Gateway is an extension of Tech For People Global Corp’s agent-native product line.

# jump to section

quickstart · formats · endpoints · agent manifest · service catalog · quote · process · pricing · capabilities · payments · health · mcp · public examples · validation · deployment · agent workflow · seo/geo files
quickstart

// Get started in 3 calls

────────────────────────────────────

# 1. discover available services

GET https://api.techforagi.com/services.json

# 2. estimate cost before processing

POST https://api.techforagi.com/quote
Content-Type: application/json

{
  "service_id": "text.summarize",
  "input_tokens_estimate": 500
}

# 3. process a request

POST https://api.techforagi.com/process
Content-Type: application/json

{
  "service_id": "text.summarize",
  "input": "TechForAGI Gateway provides machine-readable APIs for autonomous agents."
}
formats

// Response formats

────────────────────────────────────

Set the Accept header to choose your format. Use text/toon for LLM context windows (~40% fewer tokens).

JSON — application/json

Default. Standard JSON structure.

{
  "meta": {
    "request_id": "req_abc123",
    "service_id": "text.summarize",
    "format": "json",
    "cost_usd": 0.001,
    "latency_ms": 145,
    "status": "ok"
  },
  "result": {
    "summary": "This text discusses...",
    "confidence": 0.92
  }
}
TOON — text/toon

~40% fewer tokens. YAML-style objects.

meta:
  request_id: req_abc123
  service_id: text.summarize
  format: toon
  cost_usd: 0.001
  latency_ms: 145
  status: ok
result:
  summary: This text discusses...
  confidence: 0.92

# request TOON format

POST https://api.techforagi.com/process
Accept: text/toon
Content-Type: application/json

{"service_id":"text.summarize","input":"Your text..."}
endpoints

// All endpoints

────────────────────────────────────
methodpathdescriptionformat
GET/landing pageHTML
GET/.well-known/agent.jsonagent manifestJSON
GET/services.jsonservice catalogJSON
GET/services.toonservice catalog (compact)TOON
GET/servicesservices pageHTML
GET/pricing.jsonpricing metadataJSON
GET/pricing.toonpricing metadata (compact)TOON
GET/capabilities.jsoncapability catalogJSON
GET/capabilities.tooncapability catalog (compact)TOON
GET/payments/future-contract.jsonfuture payment contractJSON
GET/payments/future-contract.toonfuture payment contract (compact)TOON
GET/healthhealth checkJSON
GET/versionversion metadataJSON
POST/quotecost + latency estimateJSON / TOON
POST/processrun a serviceJSON / TOON
POST/mcpMCP JSON-RPC 2.0JSON
GET/openapi.jsonOpenAPI 3.1 specJSON
GET/llms.txtLLM-readable summarytext/plain
GET/robots.txtcrawler configtext/plain
GET/sitemap.xmlXML sitemapXML
agent manifest

// GET /.well-known/agent.json

────────────────────────────────────

Agents should fetch this first. Describes the platform, available services, formats, discovery endpoints, and payment readiness.

{
  "name": "TechForAGI Gateway",
  "version": "0.3.6",
  "phase": "phase-3-6-premium-deterministic-utilities",
  "base_url": "https://techforagi.com",
  "api_base_url": "https://api.techforagi.com",
  "formats": ["application/json", "text/toon"],
  "discovery": {
    "services": "https://api.techforagi.com/services.toon",
    "pricing": "https://api.techforagi.com/pricing.toon",
    "capabilities": "https://api.techforagi.com/capabilities.toon",
    "openapi": "https://api.techforagi.com/openapi.json",
    "mcp": "https://api.techforagi.com/mcp",
    "health": "https://api.techforagi.com/health",
    "version": "https://api.techforagi.com/version",
    "payment_contract": "https://api.techforagi.com/payments/future-contract.json"
  },
  "payment_readiness": {
    "active": false,
    "planned_protocols": ["x402", "credits", "api_key"],
    "settlement_asset": "USDC"
  },
  "recommended_workflow": [
    "GET https://techforagi.com/.well-known/agent.json",
    "GET https://api.techforagi.com/services.toon",
    "GET https://api.techforagi.com/pricing.toon",
    "POST https://api.techforagi.com/quote",
    "POST https://api.techforagi.com/process"
  ]
}
service catalog

// GET /services.toon · /services.json

────────────────────────────────────
# TOON response
services[3]{id,name,description,input,output,price_usd,status}:
  text.summarize,Text Summarize,Summarize text...,text,summary,0.001,active
  doc.extract,Document Extract,Extract fields...,text,json/toon,0.004,active
  knowledge.search,Knowledge Search,Search sources...,query,facts+sources,0.002,active
quote

// POST /quote

────────────────────────────────────

Estimate cost and latency before processing. All estimates are deterministic.

# request

{
  "service_id": "text.summarize",
  "input_tokens_estimate": 1200,
  "format": "json"
}

# parameters

fieldtypereq
service_idstringyes
input_tokens_estimateintegeryes
formatjson|toonno

# response

{
  "service_id": "text.summarize",
  "unit": "request",
  "estimated_cost_usd": 0.0016,
  "estimated_latency_ms": 420,
  "currency": "USD",
  "settlement_asset": "USDC",
  "payment": {
    "required_now": false,
    "required_future": true,
    "protocols_planned": ["x402","credits","api_key"],
    "future_http_status": 402
  }
}
agent channels

// Agent Channels Sandbox (Phase 3.5)

────────────────────────────────────

An Agent Channel is a sandbox access path: agents self-register, receive a one-time bearer token (tfagi_channel_test_...), call POST /process and MCP processing tools under quotas and rate limits. No payment is required; billing_mode is functional_testing and cost_usd is informational. Future x402/USDC settlement remains planned.

Self-registration

POST /agent-channels/register
Content-Type: application/json

{ "agent_name": "MyAgent", "payment_preference": { "mode": "sandbox", "settlement_asset": "USDC" } }

Response includes access_token once — store it securely. Never pass tokens in query strings.

Calling /process

Authorization: Bearer <access_token>
# or: X-Agent-Channel-Token: <access_token>

Quotas and rate limits

Daily/monthly request and informational cost caps apply per channel. Rate limits apply to registration (per IP) and execution (per channel). Responses may include RateLimit-* and quota fields in meta.

Security

Only token hashes are stored. Revoke via POST /agent-channels/{id}/revoke. Optional POST /agent-channels/{id}/rotate-token issues a new token and revokes the old.

YouTube-related services (deprecated)

youtube.captions.get and youtube.video.formats are deprecated. POST /process returns HTTP 410 Gone for those service_id values. MCP tools get_youtube_captions and get_youtube_video_formats remain listed for discovery but tools/call returns a deprecation error.

process

// POST /process

────────────────────────────────────

Submit a processing task. Active execution: url.readability.extract, document.basic_extract; legacy mocks: deprecated Phase 1/2 IDs. YouTube service_ids return 410. Max input: 32,000 chars (structured inputs vary by service).

text.summarize

# request
{"service_id":"text.summarize","input":"Your long text here..."}

# response
{
  "meta": {
    "request_id": "req_abc123",
    "service_id": "text.summarize",
    "cost_usd": 0.001,
    "latency_ms": 312,
    "status": "ok"
  },
  "result": {
    "summary": "This text discusses...",
    "word_count": 45,
    "confidence": 0.92,
    "key_topics": ["autonomous","agents","services"]
  }
}

doc.extract

{"service_id":"doc.extract","input":"Invoice 12/01/2025, $1,500.00 to billing@example.com"}

# result
{
  "fields_found": 3,
  "dates": ["12/01/2025"],
  "emails": ["billing@example.com"],
  "amounts": ["$1,500.00"],
  "confidence": 0.88
}

knowledge.search

{"service_id":"knowledge.search","input":"what is MCP protocol"}

# result
{
  "query": "what is MCP protocol",
  "results_count": 3,
  "results": [
    {
      "rank": 1,
      "title": "Overview: what is mcp protocol",
      "excerpt": "Trusted knowledge result...",
      "source": "techforagi-knowledge-base",
      "confidence": 0.91
    }
  ]
}

# parameters

fieldtyperequirednotes
service_idstringyestext.summarize | doc.extract | knowledge.search
inputstringyesmax 32,000 chars
formatjson|toonnooverrides Accept header
mcp

// POST /mcp — JSON-RPC 2.0

────────────────────────────────────

MCP-compatible endpoint. Protocol: JSON-RPC 2.0. Supports: initialize, tools/list, tools/call.

# list tools

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

# call a tool

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "process_text",
    "arguments": {
      "input": "text to summarize..."
    }
  }
}

# available tools

tooldescription
get_serviceslist all available services
get_pricingget pricing metadata per service
get_capabilitieslist all platform capabilities
quote_serviceestimate cost for a service call
extract_url_readabilityarticle text from URL (url.readability.extract)
extract_document_basicdeterministic fields from text (document.basic_extract)
get_youtube_captionsdeprecated — tools/call returns an error
get_youtube_video_formatsdeprecated — tools/call returns an error
process_textsummarize text (text.summarize)
extract_documentextract fields from a document (doc.extract)
search_knowledgesearch knowledge sources (knowledge.search)
get_payment_future_contractget the future x402/USDC payment contract
pricing

// GET /pricing.json · /pricing.toon

────────────────────────────────────

Per-service pricing metadata. No payment required in Phase 3.5. Exposed for discovery.

# TOON response
GET https://api.techforagi.com/pricing.toon
Accept: text/toon

pricing[3]{service_id,unit,price_usd,currency,settlement_asset,payment_required_now,...}:
  text.summarize,request,0.001,USD,USDC,false,true,x402+credits+api_key,active
  doc.extract,request,0.004,USD,USDC,false,true,x402+credits+api_key,active
  knowledge.search,request,0.002,USD,USDC,false,true,x402+credits+api_key,active

# JSON response
GET https://api.techforagi.com/pricing.json

{
  "total": 3,
  "pricing": [
    {
      "service_id": "text.summarize",
      "unit": "request",
      "price_usd": 0.001,
      "currency": "USD",
      "settlement_asset": "USDC",
      "payment_required_now": false,
      "payment_required_future": true,
      "payment_protocols_planned": ["x402","credits","api_key"]
    }
  ]
}
capabilities

// GET /capabilities.json · /capabilities.toon

────────────────────────────────────

16 platform capabilities describing what TechForAGI Gateway can do (see live /capabilities.toon for the exact set).

GET https://api.techforagi.com/capabilities.toon
Accept: text/toon

capabilities[16]{id,type,input,output,risk_level,services_using_it}:
  youtube_captions_retrieval,media,youtube_url,captions+metadata,medium,youtube.captions.get (deprecated)
  youtube_video_formats_listing,media,youtube_url,formats+signed_urls+metadata,high,youtube.video.formats (deprecated)
  web_readability_extraction,web,public_url,text+metadata,medium,url.readability.extract
  document_field_extraction,text,plain_text,structured_fields,low,document.basic_extract
  web_metadata_audit,web,public_url,metadata_audit,low,web.metadata.audit
  robots_policy_evaluation,compliance,url+user_agent,allow_disallow_policy,low,robots.policy.check
  caption_transcript_parsing,text,caption_text,timed_segments,low,captions.parse
  summarization,text,text,summary,low,text.summarize (deprecated)
  entity_extraction,nlp,text,entities,low,doc.extract (deprecated)
  knowledge_retrieval,search,query,facts+sources,medium,knowledge.search (deprecated)
  cost_estimation,billing,service_id,quote,low,quote
  format_negotiation,protocol,accept_header,response_format,low,all
  mcp_tool_call,protocol,json_rpc,tool_result,medium,mcp
  agent_discovery,discovery,http,manifest+catalog,low,agent.json+services
  usage_metering,billing,service_call,usage_event,low,all
  future_stablecoin_payment,billing,payment_proof,receipt,medium,planned
payments

// GET /payments/future-contract.json

────────────────────────────────────

Future x402/USDC payment contract specification. Payments are not active in Phase 3.5. Read this contract to understand the planned payment flow.

GET https://api.techforagi.com/payments/future-contract.json

{
  "active": false,
  "protocol": "x402",
  "settlement_asset": "USDC",
  "chain": "Base",
  "pricing_model": "per_request",
  "payment_required_current": false,
  "payment_required_future": true,
  "flow": [
    { "step": 1, "action": "quote", "actor": "agent" },
    { "step": 2, "action": "return_estimate", "actor": "gateway" },
    { "step": 3, "action": "process_request", "actor": "agent" },
    { "step": 4, "action": "payment_required", "actor": "gateway" },
    ...
  ]
}
health + version

// GET /health · GET /version

────────────────────────────────────

# health

GET https://api.techforagi.com/health

{
  "status": "ok",
  "service": "techforagi-gateway",
  "version": "0.3.6",
  "phase": "phase-3-6-premium-deterministic-utilities",
  "timestamp": "2026-04-24T...",
  "environment": "production"
}

# version

GET https://api.techforagi.com/version

{
  "name": "techforagi-gateway",
  "version": "0.3.6",
  "phase": "phase-3-6-premium-deterministic-utilities",
  "runtime": "cloudflare-workers",
  "commit": "unknown"
}
agent workflow

// Complete agent example

────────────────────────────────────
# step 1: discover
MANIFEST=$(Invoke-WebRequest -Uri "https://api.techforagi.com/.well-known/agent.json")

# step 2: list services in TOON (compact for LLM context)
SERVICES=$(Invoke-WebRequest -Uri "https://api.techforagi.com/services.toon" `
  -Headers @{Accept="text/toon"})

# step 3: quote before processing
QUOTE=$(Invoke-WebRequest -Uri "https://api.techforagi.com/quote" -Method POST `
  -Body '{"service_id":"text.summarize","input_tokens_estimate":800}' `
  -ContentType "application/json")

# step 4: process if cost is acceptable
RESULT=$(Invoke-WebRequest -Uri "https://api.techforagi.com/process" -Method POST `
  -Headers @{Accept="text/toon";"Content-Type"="application/json"} `
  -Body '{"service_id":"text.summarize","input":"Long document text..."}')

# step 5: parse request_id from meta block for audit trail
# meta.request_id: req_xxxxxx
# meta.cost_usd: 0.001
# meta.status: ok
public examples

// Public integration artifacts

────────────────────────────────────

Phase 3.5 publishes public examples for external agents and developers. These files are static, cacheable, and safe to fetch before calling live endpoints.

pathpurpose
/exampleshuman-readable integration overview
/examples/agent-workflow.tooncompact agent workflow
/examples/agent-workflow.jsonJSON workflow for clients
/examples/curlcopyable curl commands
/examples/mcpMCP JSON-RPC request examples
/for-agentsagent-focused integration guidance
/for-developersdeveloper validation guidance
/securitysecurity posture and current constraints
validation

// Smoke and OpenAPI validation

────────────────────────────────────

Smoke tests verify public endpoints over HTTP. Start Wrangler before running local smoke tests.

# local validation
npm run dev
npm run smoke
npm run validate:openapi

# deployed validation
BASE_URL=https://api.techforagi.com npm run smoke
PUBLIC_BASE_URL=https://api.techforagi.com npm run validate:public
deployment checklist

// Cloudflare Workers public deploy

────────────────────────────────────
stepcheck
1Set BASE_URL and API_BASE_URL in wrangler.toml.
2Run npm test and npm run typecheck.
3Run npm run dev, then npm run smoke.
4Deploy with npm run deploy.
5Attach custom domain routes in Cloudflare Workers.
6Run PUBLIC_BASE_URL=https://api.example.com npm run validate:public.

# Phase 3.5: optional Supabase (metering, Agent Channels). No card or on-chain settlement yet.

seo / geo files

// Machine-readable discovery files

────────────────────────────────────
pathpurpose
/robots.txtallow all crawlers + sitemap reference
/sitemap.xmlall public URLs for search indexing
/llms.txtGEO: LLM-readable plain text summary for generative search
/.well-known/agent.jsonagent discovery manifest
/openapi.jsonOpenAPI 3.1 specification