ContractSpec docs

OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

AI index

OpenAI

Integrate OpenAI's powerful AI models for chat completion, embeddings, and speech-to-text. Build intelligent features with GPT-4, generate embeddings for semantic search, and transcribe audio with Whisper.

Setup

# .env OPENAI_API_KEY=sk-... OPENAI_ORGANIZATION=org-...

Chat completions

capabilityId: openai-chat provider: type: openai operation: chatCompletion inputs: messages: type: array items: type: object properties: role: string content: string model: type: string default: "gpt-4" temperature: type: number default: 0.7 optional: true outputs: content: type: string usage: type: object

Embeddings

capabilityId: openai-embeddings provider: type: openai operation: createEmbedding inputs: text: type: string model: type: string default: "text-embedding-3-small" outputs: embedding: type: array items: type: number

Whisper (Speech-to-Text)

capabilityId: openai-transcribe provider: type: openai operation: transcribe inputs: audioFile: type: file language: type: string optional: true outputs: text: type: string language: type: string

Best practices

  • Use streaming for real-time chat responses

  • Cache embeddings to reduce API costs

  • Implement rate limiting to avoid quota issues

  • Store conversation history for context

  • Monitor token usage and costs

OSS docsintegrationsStart with OSS. Adopt Studio when you want the operating layer.

Why ContractSpec

Keep educational and comparison content reachable without letting it define the primary OSS learning path.