A WASIp2 component that implements the OpenAI Responses API. Designed to be used as an Obelisk activity.
It implements the api WIT interface which provides:
create- Create a response with structured input messagescreate-simple- Create a response with simple text inputget- Retrieve a response by IDdelete- Delete a responselist-responses- List stored responseslist-input-items- List input items for a responsecancel- Cancel an in-progress response
An OpenAI API key is required.
The key must be accessible as the OPENAI_API_KEY environment variable.
export OPENAI_API_KEY="sk-..."just buildThe component will be at target/wasm32-wasip2/release_activity/activity_openai_responses.wasm.
The component exports obelisk-components:openai-responses/api@0.1.0 with the following key types:
Errors use a variant type compatible with Obelisk's requirements:
variant api-error {
/// For Obelisk compatibility - indicates timeout or trap in last retry
execution-failed,
/// Missing or invalid API key
configuration-error(string),
/// HTTP request failed (network, timeout, etc.)
request-failed(string),
/// OpenAI API returned an error
api-error(api-error-details),
/// Failed to parse response
parse-error(string),
}create-response-request- Full request with structured messages, tools, reasoning configsimple-request- Simplified request with just text inputinput-message- Message with role and content (text, images)tool- Function, web search, file search, code interpreter, or computer use tools
response- Full response with output items, usage, statusoutput-item- Message, function call, web search, file search, reasoning outputusage- Token usage information
Build the activity and run Obelisk with appropriate configuration:
just build
obelisk server run --server-config ./server.toml --deployment ./obelisk-local.tomlSubmit a simple request:
obelisk execution submit \
-f .../api.create-simple \
-- '{"model": "gpt-4o-mini", "input": "Hello, world!"}'The component requires the following WASI interfaces:
wasi:http/outgoing-handler@0.2.9- For HTTP requests to OpenAIwasi:cli/environment@0.2.9- For reading the API key from env varswasi:io/*@0.2.9- Standard I/O interfaceswasi:clocks/monotonic-clock@0.2.9- For async runtime
MIT