The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | # yaml-language-server: $schema=../../tools/ai-codegen/codegen.schema.json |
| 2 | # To update, pin the latest openai/openai-openapi commit and regenerate from the repo root: |
| 3 | # nix develop -c node packages/tools/ai-codegen/src/bin.ts generate --provider openai |
| 4 | spec: https://raw.githubusercontent.com/openai/openai-openapi/e95c0fe615f45a19e8878af923a729948445a6bd/openapi.yaml |
| 5 | output: src/Generated.ts |
| 6 | name: OpenAiClient |
| 7 | header: | |
| 8 | /** |
| 9 | * @stability unstable |
| 10 | * @since 1.0.0 |
| 11 | */ |
| 12 | patches: |
| 13 | # Preserve the optional `name` field removed upstream. |
| 14 | - '[{"op":"add","path":"/components/schemas/ResponseFunctionCallArgumentsDoneEvent/properties/name","value":{"type":"string","description":"The name of the function that was called."}}]' |
| 15 | # Keep cache_write_tokens and access_programs optional for older and OpenAI-compatible servers. |
| 16 | - '[{"op":"replace","path":"/components/schemas/ResponseUsage/properties/input_tokens_details/required","value":["cached_tokens"]}]' |
| 17 | - '[{"op":"replace","path":"/components/schemas/Response/allOf/2/required","value":["id","object","created_at","error","incomplete_details","instructions","model","tools","output","parallel_tool_calls","metadata","tool_choice","temperature","top_p"]}]' |
| 18 | # Also accept the legacy `in-memory` spelling |
| 19 | - '[{"op":"add","path":"/components/schemas/PromptCacheRetentionEnum/enum/1","value":"in-memory"}]' |
| 20 | - '[{"op":"replace","path":"/components/schemas/OpenAIFile/properties/expires_at","value":{"anyOf":[{"type":"integer","format":"unixtime","description":"The Unix timestamp (in seconds) for when the file will expire."},{"type":"null"}]}}]' |
| 21 | - '[{"op":"replace","path":"/components/schemas/OpenAIFile/properties/status_details/type","value":["string","null"]}]' |
| 22 | # Remove when the upstream schema includes named API sources: https://github.com/openai/openai-openapi/issues/573 |
| 23 | - '[{"op":"replace","path":"/components/schemas/WebSearchActionSearch/properties/sources/items","value":{"anyOf":[{"type":"object","title":"Web search source","description":"A source used in the search.\n","properties":{"type":{"type":"string","enum":["url"],"description":"The type of source. Always `url`.\n","x-stainless-const":true},"url":{"type":"string","format":"uri","description":"The URL of the source.\n"}},"required":["type","url"]},{"type":"object","title":"Web search API source","description":"An API source used in the search.\n","properties":{"type":{"type":"string","enum":["api"],"description":"The type of source. Always `api`.\n","x-stainless-const":true},"name":{"type":"string","description":"The name of the API source, such as `oai-weather`, `oai-sports`, or `oai-finance`.\n"}},"required":["type","name"]}]}}]' |
| 24 | # OpenAI may omit the find-in-page URL: https://github.com/openai/openai-openapi/issues/571 |
| 25 | # Also tolerate omitted patterns without substituting a value. |
| 26 | - '[{"op":"replace","path":"/components/schemas/WebSearchActionFind/required","value":["type"]}]' |
| 27 | # Add missing keepalive stream event support |
| 28 | - '[{"op":"add","path":"/components/schemas/ResponseKeepAliveEvent","value":{"type":"object","title":"Keep alive","description":"A keepalive event emitted during long-running response streams.","properties":{"type":{"type":"string","enum":["keepalive"],"description":"The type of the keepalive event. Always `keepalive`.","default":"keepalive","x-stainless-const":true},"sequence_number":{"type":"integer","description":"The sequence number of this keepalive event."}},"required":["type","sequence_number"]}}]' |
| 29 | - '[{"op":"add","path":"/components/schemas/ResponseStreamEvent/anyOf/-","value":{"$ref":"#/components/schemas/ResponseKeepAliveEvent"}}]' |
| 30 | # Add missing ResponseApplyPatchCallOperationDiffDeltaEvent schema |
| 31 | - '[{"op":"add","path":"/components/schemas/ResponseApplyPatchCallOperationDiffDeltaEvent","value":{"title":"ResponseApplyPatchCallOperationDiffDelta","type":"object","description":"Event representing a delta for an apply_patch tool call operation diff.","properties":{"type":{"type":"string","enum":["response.apply_patch_call_operation_diff.delta"],"description":"The event type identifier.","x-stainless-const":true},"sequence_number":{"type":"integer","description":"The sequence number of this event."},"output_index":{"type":"integer","description":"The index of the output this delta applies to."},"item_id":{"type":"string","description":"Unique identifier for the API item associated with this event."},"delta":{"type":"string","description":"The incremental diff data for the apply_patch tool call."}},"required":["type","output_index","item_id","delta","sequence_number"]}}]' |
| 32 | # Add missing ResponseApplyPatchCallOperationDiffDoneEvent schema (delta is optional - not always sent by OpenAI) |
| 33 | - '[{"op":"add","path":"/components/schemas/ResponseApplyPatchCallOperationDiffDoneEvent","value":{"title":"ResponseApplyPatchCallOperationDiffDone","type":"object","description":"Event indicating that the operation diff for an apply_patch tool call is complete.","properties":{"type":{"type":"string","enum":["response.apply_patch_call_operation_diff.done"],"description":"The event type identifier.","x-stainless-const":true},"sequence_number":{"type":"integer","description":"The sequence number of this event."},"output_index":{"type":"integer","description":"The index of the output this event applies to."},"item_id":{"type":"string","description":"Unique identifier for the API item associated with this event."},"delta":{"type":"string","description":"The final diff data for the apply_patch tool call."}},"required":["type","output_index","item_id","sequence_number"]}}]' |
| 34 | # Add both events to ResponseStreamEvent anyOf array |
| 35 | - '[{"op":"add","path":"/components/schemas/ResponseStreamEvent/anyOf/-","value":{"$ref":"#/components/schemas/ResponseApplyPatchCallOperationDiffDeltaEvent"}}]' |
| 36 | - '[{"op":"add","path":"/components/schemas/ResponseStreamEvent/anyOf/-","value":{"$ref":"#/components/schemas/ResponseApplyPatchCallOperationDiffDoneEvent"}}]' |
| 37 | excludeAnnotations: |
| 38 | - examples |
| 39 | - default |
| 40 | disableAdditionalProperties: true |
| 41 | replacements: |
| 42 | # Schema.Unknown doesn't work with Schema.toCodecJson (used by HttpClientResponse.schemaBodyJson) |
| 43 | # Replace with Schema.Json which properly handles arbitrary JSON values |
| 44 | - from: "Schema.Record(Schema.String, Schema.Unknown)" |
| 45 | to: "Schema.Record(Schema.String, Schema.Json)" |
| 46 | - from: "{ readonly [x: string]: unknown }" |
| 47 | to: "{ readonly [x: string]: Schema.Json }" |