Skip to main content

Crate kcode_openai_api

Crate kcode_openai_api 

Source
Expand description

OpenAI audio transcription, prompt-driven image analysis, and GPT Image generation.

OpenAi owns an API key and exposes the direct OpenAI API operations currently needed by Kennedy: gpt-4o-transcribe audio transcription, gpt-5.6 single-image analysis, and gpt-image-2 image generation. The crate does not persist credentials, requests, responses, or media.

Structs§

AgentTokenUsage
Token usage for one OpenAI text/tool turn.
AgentTool
One function available to an OpenAI text turn.
AgentToolCall
One normalized function call returned by OpenAI.
AgentTurnRequest
One non-streaming OpenAI text/tool turn.
AgentTurnResponse
Normalized result of one non-streaming OpenAI text/tool turn.
AudioInput
One in-memory audio file accepted by gpt-4o-transcribe.
GeneratedImage
One generated image held in memory.
ImageAnalysis
Normalized prompt-driven image-analysis result.
ImageAnalysisRequest
One prompt-driven image-analysis request.
ImageAnalysisUsage
Documented Responses API token usage retained for image analysis.
ImageEditRequest
One GPT Image 2 request that modifies or combines reference images.
ImageGeneration
Normalized single-image GPT Image 2 result.
ImageGenerationRequest
One GPT Image 2 text-to-image request.
ImageInput
One caller-owned in-memory image accepted for image analysis.
ImageTokenDetails
Text and image token detail for GPT Image usage.
ImageUsage
Token usage returned by GPT Image.
ModelMetadata
Metadata advertised for one exact OpenAI model.
OpenAi
Cloneable asynchronous OpenAI client for transcription, image analysis, and image generation.
Transcription
Normalized gpt-4o-transcribe result.
TranscriptionRequest
One audio transcription request.
TranscriptionTokenDetails
Modality detail for token-billed audio transcription input.
TranscriptionTokenUsage
Token-billed transcription usage.

Enums§

Error
A local validation, transport, provider, or protocol failure.
ImageAnalysisStatus
Completion state of a non-streaming image-analysis response.
ImageBackground
Background selection supported by GPT Image 2.
ImageDetail
OpenAI image-understanding detail level.
ImageFormat
GPT Image output file format.
ImageMediaType
Stored image media accepted for image analysis.
ImageQuality
GPT Image rendering quality.
ImageSize
Generated image dimensions.
Moderation
Provider content-moderation level.
TranscriptionUsage
Usage returned for a transcription request.

Constants§

DEFAULT_TRANSCRIPTION_PROMPT
Default transcription guidance preserving Kennedy’s current behavior.
GPT_4O_TRANSCRIBE
OpenAI model used for audio transcription.
GPT_5_6
OpenAI model used for prompt-driven image analysis.
GPT_IMAGE_2
Latest GPT Image model used for image generation.

Type Aliases§

Result
The result type returned by this crate.