1. Documentation
The Delegation
  • Documentation
    • Getting started
    • TypeScript client
    • Python client
    • Go client
    • Operations and observability
  • AI Gateway
    • Chat
      • Create a chat completion
    • Embeddings
      • Create text embeddings
    • Audio
      • Transcribe audio with AWS Transcribe
      • Text-to-speech
    • Images
      • Generate images with Gemini
    • Models
      • List available models
      • Retrieve a model
    • Users
      • List all users
      • Create a user
      • Get a user
      • Delete a user
      • Get user usage and cost summary
    • Health
      • Liveness / readiness probe
      • Provider health check
      • Gateway info
    • Admin
      • Per-provider request metrics
      • List configured providers
    • Schemas
      • ContentPartText
      • ContentPartImageURL
      • ContentPartAudio
      • ContentPartVideo
      • ContentPartDocument
      • ContentPart
      • FunctionDef
      • Tool
      • ToolCall
      • ChatMessage
      • ChatRequest
      • Usage
      • Choice
      • ChatResponse
      • EmbeddingsRequest
      • EmbeddingObject
      • EmbeddingsResponse
      • TranscriptionResponse
      • TTSRequest
      • ImageGenerationRequest
      • ImageData
      • ImageGenerationResponse
      • ModelInfo
      • ModelList
      • UsageRecord
      • User
      • UserUsageSummary
      • ProviderHealth
      • HealthResponse
      • ProviderMetrics
      • MetricsResponse
      • ErrorDetail
      • ErrorResponse
  • Platform API
    • Projects
      • List projects
      • Create project
      • Get project
      • Update project
      • Delete project
    • Tasks
      • Create task
      • Get task
      • Update task
    • Conversations
      • Get conversation
      • Clear conversation
      • Send message
    • Keys
      • Gateway usage statistics
    • Account
      • Get account
      • Update account role
      • Delete account
    • Schemas
      • Error
      • ChatMessage
      • ToolDefinition
      • ToolCall
      • ChatCompletionRequest
      • ChatCompletionResponse
      • EmbeddingRequest
      • ImageGenRequest
      • Project
      • Task
      • Message
      • Conversation
      • UserFile
      • GatewayKey
      • User
      • UserBalance
      • AuthSession
      • Session
  • File Service
    • Files
      • List files
      • Upload file
      • Update file
      • Delete / trash file
      • Restore file from trash
    • Schemas
      • Error
      • ChatMessage
      • ToolDefinition
      • ToolCall
      • ChatCompletionRequest
      • ChatCompletionResponse
      • EmbeddingRequest
      • ImageGenRequest
      • Project
      • Task
      • Message
      • Conversation
      • UserFile
      • GatewayKey
      • User
      • UserBalance
      • AuthSession
      • Session
  1. Documentation

Getting started

The Delegation developer documentation#

Use the service navigation to find the AI Gateway, Platform API, and File Service references. Client guides contain runnable TypeScript, Python, and Go integrations.
ServiceProduction base URLAuthentication
AI Gatewayhttps://gateway.malcolmstone.io/v1Provisioned server-side gateway key
Platform APIhttps://delegation.malcolmstone.io/apiLive session token or cookie
File Servicehttps://delegation.malcolmstone.io/api/user-filesLive session token or cookie
OperationsGateway health and Phoenix tracesOperator access for dashboards
Gateway credentials belong in server processes. End users do not create gateway keys. Browser requests use /api/gateway/v1/... on the platform, which checks the session and attributes usage to the signed-in user. Secrets are injected from AWS Secrets Manager; no .env file is required.

Choose a model#

claude-sonnet-4-6 is the default for agents. gemini-2.5-flash provides a Google alternative. The model prefix selects the provider automatically. Use GET /v1/models?provider=claude to filter discovery or GET /v1/models/{model} to inspect a model. The catalog describes adapter support; quota and upstream account availability can still affect requests.
Embeddings use gemini-embedding-001 with 768 dimensions for platform documents. Images use gemini-2.5-flash-image. Speech uses aws-polly and transcription uses aws-transcribe with provider bedrock.

Handle errors and streams#

Error responses use { "error": { "type": "...", "message": "...", "code": "..." } }. Keep the X-Request-ID response header when reporting failures. HTTP 429 includes Retry-After in seconds. Do not retry validation or authentication errors. Retrying a generation can incur another charge; there is no idempotency guarantee.
Claude and Gemini streaming uses SSE. A successful stream ends with [DONE]. stream_options.include_usage=true adds a final usage event whose choices array is empty. After streaming begins, a provider failure arrives as an error event and does not emit [DONE]. Always handle SDK exceptions or StreamReader.Err().
The supported surface is Chat Completions, not the Responses or Assistants APIs. Tool execution stays in your application: execute only approved tools, then return their results with the matching tool_call_id.
Modified at 2026-10-20 19:24:00
Next
TypeScript client
Built with