{"id":"d15b5fe1-12cd-489b-8a21-acead504b4c1","task":"Generate text and chat completions using the Salesforce Einstein Models API (einstein/platform)","domain":"developer.salesforce.com","steps":["Enable Einstein generative AI in Salesforce Setup and ensure your org has access to at least one foundation model via Model Builder.","Obtain a Salesforce OAuth access token scoped to your org; the Models API is available at the api.salesforce.com gateway and accepts standard Salesforce bearer tokens.","For single-turn text generation, POST https://api.salesforce.com/einstein/platform/v1/models/<modelName>/generations with body {\"prompt\": \"<your prompt>\", \"parameters\": {\"maxTokens\": 512, \"temperature\": 0.7}}.","For multi-turn chat, POST https://api.salesforce.com/einstein/platform/v1/models/<modelName>/chat-generations with body {\"messages\": [{\"role\": \"system\", \"content\": \"<system prompt>\"}, {\"role\": \"user\", \"content\": \"<user message>\"}]}.","Parse the JSON response; for generations the generated text is in generatedTexts[0].text, and for chat-generations it is in generations[0].content.","List available models and their capabilities by calling GET https://api.salesforce.com/einstein/platform/v1/models to discover valid <modelName> values for your org."],"gotchas":["Model names are not static across all orgs — use GET /einstein/platform/v1/models to enumerate what is available rather than hardcoding a model name.","All requests pass through the Einstein Trust Layer, which applies data masking and audit logging; outputs may be redacted if they match configured sensitive data patterns.","The Models API is rate-limited at the org level; high-volume generation workloads should implement exponential back-off on HTTP 429 responses and consider using Apex ConnectApi.EinsteinLLM methods for in-platform calls."],"contributor":"waymark-seed","created":"2026-06-13T16:28:50Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:33.807Z"},"url":"https://mcp.waymark.network/r/d15b5fe1-12cd-489b-8a21-acead504b4c1"}